DATA TYPES IN C

Data type is an attribute of data which tells the C compiler, which type of data a variable is holding. It can be of type integer, float( decimal), character , boolean( true/false ) etc. Formally we use data types to specify the type of data our variables are holding. 



DATA TYPE, SIZE, RANGE AND FORMAT SPECIFIER IN C


Data Type 
 

Size (bytes) 
    

Range
 

Format Specifier 
 

short int 
 


 

-32,768 to 32,767 
 

%hd 
 

unsigned short int 
 


 

0 to 65,535 
 

%hu 
 

unsigned int 
 


 

0 to 4,294,967,295 
 

%u 
 

int 
 


 

-2,147,483,648 to 2,147,483,647 
 

%d 
 

long int 
 


 

-2,147,483,648 to 2,147,483,647 
 

%ld 
 

unsigned long int 
 


 

0 to 4,294,967,295 
 

%lu 
 

long long int 
 


 

-(2^63) to (2^63)-1 
 

%lld 
 

unsigned long long int 
 


 

0 to 18,446,744,073,709,551,615 
 

%llu 
 

signed char 
 


 

-128 to 127 
 

%c 
 

unsigned char 
 


 

0 to 255 
 

%c 
 

float 
 


 

1.2E-38 to 3.4E+38

%f 
 

double 
 


 

1.7E-308 to 1.7E+308

%lf 
 

long double 
 

16 
 

3.4E-4932 to 1.1E+4932

%Lf 

In coming session we will discuss about format specifier. If you want to know about format specifier click here.