Friday 24 July 2015

SIZE OF DATA TYPE

  • 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.NoC Data typesstorage SizeRange
1char1–127 to 127
2int2–32,767 to 32,767
3float41E–37 to 1E+37 with six digits of precision
4double81E–37 to 1E+37 with ten digits of precision
5long double101E–37 to 1E+37 with ten digits of precision
6long int4–2,147,483,647 to 2,147,483,647
7short int2–32,767 to 32,767
8unsigned short int20 to 65,535
9signed short int2–32,767 to 32,767
10long long int8–(2power(63) –1) to 2(power)63 –1
11signed long int4–2,147,483,647 to 2,147,483,647
12unsigned long int40 to 4,294,967,295
13unsigned long long int82(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