The letter “L” in C/C++ is called a long constant and most of the time it is written in capital letter “L” so that we don’t get confused with small letter l and 1 ONE
Basically, the purpose of using the letter “L” is to overcome the overflow that usually happens in a 16-bit machine
But, why only a 16-bit machine
Because in a 16-bit machine, the gap between int and long int is huge
Nowadays, people won’t use a 16-bit machine instead they use a 32-bit machine or 64-bit machine
In reality, the 16-bit machine has int range from -32,768 to 32,767 which is disgustingly so, small
As a result, in a 16-bit machine the programmer usually, switches from low range to high range by using the letter “L” which was the jackpot in the olden days
At this time, we don’t use the letter “L” in most of the programs because, in a 32-bit machine, the range of int is the same as the long int
That is, fairly large enough for normal tasks
At the present time, C99 has introduced the new standard integer types called long long int and unsigned long long int to support newer 64-bit processor
By and large, it was introduced because of the growing demand for large integers in sum, to support 64-bit arithmetic
To point out, the long long type is required at least 64-bit wide to use the range the range that is -9,223,372,036,854,775,807 to
-1 that is -9,223,372,036,854,775,807
Here are some data types range for 16-bit, 32-bit, and 64-bit machine
16-bit machine
Data type | Low | High |
---|---|---|
short int | -32.768 | 32,767 |
unsigned short int | 0 | 65,535 |
int | -32,768 | 32,767 |
unsigned int | 0 | 65,535 |
long int | -2,147,483,648 | 2,147,483,647 |
unsigned long int | 0 | 4,294,967,295 |
32-bit machine
Data type | Low | High |
---|---|---|
short int | -32,768 | 32,767 |
unsigned short int | 0 | 65,535 |
int | -2,147,483,648 | 2,147,483,647 |
unsigned int | 0 | 4,294,967,295 |
long int | -2,147,483,648 | 2,147,483,647 |
unsigned long int | 0 | 18,446,744,073,709,551,615 |
64-bit machine
Data type | Low | High |
---|---|---|
short int | -32,768 | 32,767 |
unsigned short int | 0 | 65,535 |
int | -2,147,483,648 | 2,147,483,647 |
unsigned int | 0 | 4,294,967,295 |
long int | -9,223,372,036,854,775,808 | 9,223,372,036,854,775,807 |
unsigned long int | 0 | 18,446,744,073,709,551,615 |
Leave a Reply