- Below table gives the detail about the storage size of each C basic data type in 16 bit processor.
Please keep in mind that storage size and range for int and float datatype will vary depend on the CPU processor (8,16, 32 and 64 bit)
S.No | C Data types | storage Size | Range |
1 | char | 1 | –127 to 127 |
2 | int | 2 | –32,767 to 32,767 |
3 | float | 4 | 1E–37 to 1E+37 with six digits of precision |
4 | double | 8 | 1E–37 to 1E+37 with ten digits of precision |
5 | long double | 10 | 1E–37 to 1E+37 with ten digits of precision |
6 | long int | 4 | –2,147,483,647 to 2,147,483,647 |
7 | short int | 2 | –32,767 to 32,767 |
8 | unsigned short int | 2 | 0 to 65,535 |
9 | signed short int | 2 | –32,767 to 32,767 |
10 | long long int | 8 | –(2power(63) –1) to 2(power)63 –1 |
11 | signed long int | 4 | –2,147,483,647 to 2,147,483,647 |
12 | unsigned long int | 4 | 0 to 4,294,967,295 |
13 | unsigned long long int | 8 | 2(power)64 –1 |
Q WHY ONLY SIZE OF INT DATA TYPE VARIES WITH DIFFERENT ARCHITECTURE
The smaller types have the advantage of taking up less memory, the larger types incur a performance penalty. Variables of type int store the largest possible integer which does not incur this performance penalty. For this reason, int variables can be different depending what type of computer you are using.
OR
Size of data types in c programming language turbo C and GCC compilers
Size of data types in the 16 bit compilers, like TURBO c++ 3.0, Borland c++ etc:
Size of data types in the 32 bit compilers. Example: LINUX gcc compiler, Turbo c 4.5 etc:
No comments:
Post a Comment