Data Types in C
C offers a standard, minimal set of basic datatypes. Sometimes these are called “primitive” types. A lot of complex data structures can be developed from these basic data types. The C language defines 4 fundamental data types:
This data types are declared using the keywords char,int,float and double respectively. Typical memory requirements of the basic data types are given below
Size qualifiers :
The size and range of these data types may vary among processor types and compilers. Data type qualifiers modify the behavior of variable type to which they are applied. Data type qualifiers can be classified into two types.two types.
1. size qualifiers
2. sign qualifiers
Size qualifiers alter the size of the basic data types. There are two size qualifiers that can be applied to integer: short and long.
The minimum size of short int is 16 bit. The size of int must be greater than or equal to that of a short int. The size of long int must be greater than or equal to a short int. The minimum size of a long int is 32 bits.
Sign qualifiers :
The keywords signed and unsigned are the two sign qualifiers that specify whether a variable can hold both –ve and +ve numbers, or only +ve numbers. These qualifiers can be applied to the data types int and char only.
Example: unsigned int I;
The following table shows all valid data type combinations supported by C, along with their minimal ranges and typical memory size.