What is size of each data types in C programming?


Size of data type depends upon microprocessor. Each microprocessor defines its own word length. On the basis of word length in general we can say:
1. Size of int is word length.
2. Size of short int can be >= word length/2 but <=word length Size of long int can be <= 2*word length but >=word length.
3. Size of char, float, double, long double is always fix.
4. Size of enum is size of int.
Turbo C is based on 8086 microprocessor and its word length is two byte
For TURBO C or 8085 processor (Word length = 2 byte)
Data type           
Size (In byte)
char 
1
short int              
2
int  
2
long int                
4
enum
2
float
4
double
8
long double            
10

Note: Modifier likes signed, unsigned etc. doesn’t change the size of any data type.

No comments: