So I recently started programming and in the lesson i'm on it is teaching about integer types. I found the use of int, and how to use INT_MAX to find the max output of int. But it also said to use long int for something larger. As i created my code using long int, and adding another digit to my number i got a warning staying "overflow in implicit constant conversion [-Woverflow]" And when i use the LONG_MAX to find the max, it comes out to be the exact same as the INT_MAX. Does anyone know why this happens? Is it an issue with my compiler?
Because long can be the same size as int.
Types like char, short, int, long, long long do not have set size. They have constraints on both relations between them (for example no type can be larger than type after it in posted sequence and sizeof char is always 1) and minimum size (short is at least 16 bit long). http://en.cppreference.com/w/cpp/language/types
Scroll down to Propertires and look at the table provided.
Thank you for clearing that up for me. This video I am learning from made and Int and then just made the number larger and switched to long int. And when i did the same thing I got the error and though I was either being stupid or that my compiler was just wrong in some way. So this is a common thing then and i shouldn't be concerned?