Data Types in C

Basic data types in C

There are very few data types provided by C.
C does not provide any data-type for storing text as the it is made up of individual characters.

Following table shows the basic data-types:

Data-typeKeywordStorage size in bytesRangeUse
Characterchar1-128 to 127For storing characters.
Integerint2-32768 to 32767For storing integer numbers.
Floating Pointfloat43.4E-38 to 3.4E+38For storing the floating point numbers.
Doubledouble81.7E-308 to 1.7E+308For storing the big floating point numbers.

In the above table we have a data-type called 'void' which has no value but is used in the following cases:
  • For specifying the return type of the function when the function returns no value.
  • For specifying the parameters of the function when no arguments are accepted by the function from the caller.
  • For creating generic pointers.
The unsigned and signed char is used for ensuring the portability of the programs which store the non-character data as char.

Following table shows the different signed and unsigned char:

Data-typeStorage size in bytesRange
char1-128 to 127
unsigned char10 to 255
signed char1-128 to 127
int2-32768 to 32767
unsigned int20 to 65535
signed short int2-32768 to 32767
signed int2-32768 to 32767
short int2-32768 to 32767
unsigned short int20 to 65535
long int4-2147483648 to 2147483647
unsigned long int40 to 4294967295
signed long int4-2147483678 to 2147483647
float43.4E-38 to 3.4E+38
double81.7E-308 to 1.7E+308
long double103.4E-4932 to 1.1E+4932