Difference between doing.. for example: long int, short int

Difference between doing.. for example: long int, short int and doing long, short?
But they're the same right? I can just do long number = 4279847128; instead of doing long int number = 4279847128; ?
So I can just forget about typing 'int' when doing something like short number = 24214;
While you can, I recommend you be explicit about your types.

sizeof(short) is guaranteed to be <= sizeof(int), but they are not guaranteed to be the same size. With Visual Studio at least, short holds 2 bytes, while int holds 4. Don't assume they'll be the same size.
Their sizes need only satisfy the requirement
1 == sizeof(char) <= sizeof(short) <= sizeof(int) <= sizeof(long) <= sizeof(long long)

http://en.cppreference.com/w/cpp/language/types
Topic archived. No new replies allowed.