answersLogoWhite

0


Best Answer

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.

User Avatar

Wiki User

16y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

This information may depend on your particular C implementation. Typically a short int is 16 bits, an int is 32 bits, and a long int is 64 bits. However, variations on how exactly keywords are combined to define a particular size are common.

For instance, in some implementations a long or long int is 32 bits, while a long long int is 64 bits.

Similarly, a short, short int, and int may all be 16 bits.

In summary:

* A short or short int is almost always 16 bits. * An int can be either 16 or 32 bits. * A long or long int can be either 32 or 64 bits. * A long longor long long int is almost always 64 bits. See the documentation for your implementations (or do some experimentation in your code) to figure out exactly what each type means for you.

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

In Java, an int uses 4 bytes - thus giving a range up to about 2 billion (9-10 digits). A long uses 8 bytes, for a range of up to about 19 digits.

In Java, an int uses 4 bytes - thus giving a range up to about 2 billion (9-10 digits). A long uses 8 bytes, for a range of up to about 19 digits.

In Java, an int uses 4 bytes - thus giving a range up to about 2 billion (9-10 digits). A long uses 8 bytes, for a range of up to about 19 digits.

In Java, an int uses 4 bytes - thus giving a range up to about 2 billion (9-10 digits). A long uses 8 bytes, for a range of up to about 19 digits.

This answer is:
User Avatar

User Avatar

Wiki User

15y ago

Data size and value range:

short int: 2 bytes, -32768..32767

int: 4 bytes, -4294967296..4294967295

This answer is:
User Avatar

User Avatar

Wiki User

12y ago

size (cf sizeof) and value range (-28*sizeof-1..28*sizeof-1-1)

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

In Java, an int uses 4 bytes - thus giving a range up to about 2 billion (9-10 digits). A long uses 8 bytes, for a range of up to about 19 digits.

This answer is:
User Avatar

User Avatar

Wiki User

15y ago

There is no difference.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Short int and long integers have how many bytes in C programming?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

How many bytes does long and short data type reserve?

sizeof (long) and sizeof (short) often 4 or 8 for long, and 2 for short


State and explain any 4 predefined data types in C plus plus programming?

A char is always 1 byte long, but may be signed or unsigned depending on the implementation. Explicitly signed or unsigned char types are treated as being independent types from the implicit char type (3 separate types).A short (or short int) is at least 2 bytes long while a long (or long int) is at least 4 bytes long. Both are implementation-dependent with regard their actual size and sign, but, like char, may be explicitly signed.Char, short and long are used to store integers (whole numbers). A char can store signed values in the range -128 to +127, or unsigned values in the range 0 to 255.A double is at least 8 bytes long while its shorter counterpart, a float, is at least 4 bytes long. Both are implicitly signed, floating point values.To determine the length of any type (including predefined types) us the sizeof operator.


What is the sizeof long int?

The sizeof long int is platform-dependent, often 4 bytes or 8 bytes.


Integers need how many bits to stored in C plus plus?

It depends on the type of integer (such as long, short, int and char) and the specific implementation of C++. The only guarantee is that a char must occupy one byte (sizeof(char)==1). An int is typically 32-bits (4 bytes), but only sizeof(int) can tell you for sure.


Who decides size of data types in a language?

The people who create the language take the liberty of deciding the size of data types in a programming lanauage.If you (as a programmer) create your own custom data type, for example by defining a class, then you decide what goes into it - for example, in Java, if one of the pieces of data requires an integer, you have the choice of storing it as an int, which uses 4 bytes, or as a long, which uses 8 bytes (and permits larger numbers).

Related questions

What are the types of operands and operation?

bytes integers long integers short integers word double word strings


How many bytes does long and short data type reserve?

sizeof (long) and sizeof (short) often 4 or 8 for long, and 2 for short


State and explain any 4 predefined data types in C plus plus programming?

A char is always 1 byte long, but may be signed or unsigned depending on the implementation. Explicitly signed or unsigned char types are treated as being independent types from the implicit char type (3 separate types).A short (or short int) is at least 2 bytes long while a long (or long int) is at least 4 bytes long. Both are implementation-dependent with regard their actual size and sign, but, like char, may be explicitly signed.Char, short and long are used to store integers (whole numbers). A char can store signed values in the range -128 to +127, or unsigned values in the range 0 to 255.A double is at least 8 bytes long while its shorter counterpart, a float, is at least 4 bytes long. Both are implicitly signed, floating point values.To determine the length of any type (including predefined types) us the sizeof operator.


In main memory how many bits num variable will hold?

That depends on the programming language, and on the specific data type. Java, for example, has integers of different sizes; for example, an int uses 4 bytes, and a long uses 8 bytes. It also has shorter integer data types. Java also has different types of floating point numbers; for example, a double uses 8 bytes, and a float uses 4 bytes. Java also has classes for arbitrary-precision math (classes BigInt and BigMath); in this case, the size in memory for a number will vary, depending on the number of digits.That depends on the programming language, and on the specific data type. Java, for example, has integers of different sizes; for example, an int uses 4 bytes, and a long uses 8 bytes. It also has shorter integer data types. Java also has different types of floating point numbers; for example, a double uses 8 bytes, and a float uses 4 bytes. Java also has classes for arbitrary-precision math (classes BigInt and BigMath); in this case, the size in memory for a number will vary, depending on the number of digits.That depends on the programming language, and on the specific data type. Java, for example, has integers of different sizes; for example, an int uses 4 bytes, and a long uses 8 bytes. It also has shorter integer data types. Java also has different types of floating point numbers; for example, a double uses 8 bytes, and a float uses 4 bytes. Java also has classes for arbitrary-precision math (classes BigInt and BigMath); in this case, the size in memory for a number will vary, depending on the number of digits.That depends on the programming language, and on the specific data type. Java, for example, has integers of different sizes; for example, an int uses 4 bytes, and a long uses 8 bytes. It also has shorter integer data types. Java also has different types of floating point numbers; for example, a double uses 8 bytes, and a float uses 4 bytes. Java also has classes for arbitrary-precision math (classes BigInt and BigMath); in this case, the size in memory for a number will vary, depending on the number of digits.


What do you mean by long integer and double integer?

Different computer languages use different amounts of memory to store integers. For example, C++ uses a minimum of 4 bytes, Java a min of 8 bytes. A long integer is one which is requires more bytes than the standard amount. When the storage requirement gets to twice the standard amount, the number becomes a double integer.


How many bytes consists of ATM cell?

53 bytes long


What is the sizeof long int?

The sizeof long int is platform-dependent, often 4 bytes or 8 bytes.


Integers need how many bits to stored in C plus plus?

It depends on the type of integer (such as long, short, int and char) and the specific implementation of C++. The only guarantee is that a char must occupy one byte (sizeof(char)==1). An int is typically 32-bits (4 bytes), but only sizeof(int) can tell you for sure.


How many bytes in a Mac address?

A Mac address (Media Access Control address) is 48 bits long, which is equivalent to 6 bytes.


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.


How linked can be used to represent long integers?

Whatever linked is, I don't think it can be used to represent long integers.


How long is 2 GB calling?

giga bytes