answersLogoWhite

0

What is the difference between short int and long int?

Updated: 8/17/2019
User Avatar

Wiki User

14y ago

Best Answer

Value range.

Tipical v.r. for short int: -2^15 .. 2^15-1
Tipical v.r. for int: -2^15 .. 2^15-1 or -2^31 .. 2^31-1
Tipical v.r. for long int: -2^31 .. 2^31-1 or -2^63 .. 2^63-1
Tipical v.r. for long long int: -2^63 .. 2^63-1

Of course all of these are platform-dependent.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the difference between short int and long int?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What are the four integral types in C plus plus?

There are far more than 4 integral types in C++. As of C++11, there were 27 integral types: bool char signed char unsigned char wchar_t char16_t char32_t short signed short unsigned short short int signed short int unsigned short int int signed int unsigned int long signed long unsigned long long int signed long int unsigned long int long long signed long long unsigned long long long long int signed long long int unsigned long long int


What is the difference between int a and int a in C?

nothing


What is the difference between int and short in c plus plus language?

They are both integral types however they may have different lengths (in bytes) such that an int is guaranteed to be at least as long as a short. Note that the name, short, is actually a modifier rather than a type and literally means a short int. The other modifiers are long, signed and unsigned. When modifiers are used without an explicit type, int is implied. This is in common with C where int is the default type. On most implementations, a char is 1 byte in length, a short is 2 bytes and an int is 4 bytes. sizeof(char)==1 can be guaranteed across all implementations but the lengths of all other integral types are implementation-defined. All we can guaranteed is that the relationship between their respective lengths is as follows: char <= short <= int <= long <= long long Note that the signed or unsigned modifiers do not affect integral lengths in any way, they simply change the interpretation.


Why does int has the same range as short?

The int is a data type in c, c++ or java, It can divided in to two parts that is short and long. Int short if of same size as int (2).


What is the difference between int and int32?

The size (and value-range) of int is platform-dependent, whilst that of int32_t is fixed.


What is the difference between datatypes and modifiers in c language?

For example 'int' is a data-type, 'short', 'long', 'signed' and 'unsigned' are modifiers, 'extern', 'auto', 'static', 'register' are storage-classes. The declarations go like this: storage-class modifiers data-type identifier example: static unsigned short int x;


What is the Difference between normal int and regular int?

Are you sure that these words (normal int and regular int) actually mean something?


How integer classified in java?

int short byte long


How you assign int to short if s is short and i is int?

By type casting since int is of larger bits than short s=(int)i;


Short int and long integers have how many bytes in C programming?

It depends on the programming language, the compiler, and the machine architecture. In C, the size of short int and int is not mandated by the language. Often, on 32-bit machines, 'int' will be 32-bit, while 'short int' may be 16-bit. But the only thing the language promises is that short int will be no larger than int.


Why does c plus plus have type modifiers?

There are four modifiers in C++: long, short, signed and unsigned. They are used to modify primitive types (int, char, float and double) to change their behaviour. If no type is specified, int is assumed. Thus a long long turns a 32-bit integer into a 64-bit integer while unsigned ensures an integer is always in the positive range.


What is the types of data?

int, but can be assigned to a short, long or char as well