C Data Types
Data are raw facts and figures which can be letters or numbers. In C there are different types of data which can be used . They are stored differently in computer's memory and thus occupy different amount of spaces.
Examples of data are 12 ,12.5,a etc where 12 is an integer int , 12.5 is floating point float , 'a' is character char
Following table represents data type and their Memory requirement for 16 bit personal computer .
Note : This may change for higher modern 32 bit and 64 bit computers and also depends on version of compiler using
Datatype | Description | Memory Required |
int | Integer | 2 or 4 bytes |
char | single character | 1 byte |
float | floating-point number or decimal number | 4 bytes |
double | floating-point number with more range or large decimal numbers | 8 bytes |
Above given datatype are primary datatype . All the datatype with range and size is given below.
Datatype | Range | Memory Required |
int | -32,768 to +32767 | 2 bytes |
usigned int | 0 to 65535 | 2 bytes |
short int | -32,768 to +32767 | 2 bytes |
unsigned short int | 0 to 65535 | 2 bytes |
long int | -2,147,483,648 to +2,147,483,647 | 4 bytes |
unsigned long int | 0 to +4,294,967,295 | 4 bytes |
char | any single character from numeric -128 to +127 | 1 byte |
unsigned char | any single character from numeric 0 to 255 | 1 byte |
float | 3.4E-38 to 3.4E+38 | 4 bytes |
double | 1.7E-308 to 1.7E+308 | 8 bytes |
long double | 3.4E-4932 to 1.1E+4932 | 10bytes |