Datatypes in C :
Datatypes is a data storage format that can contain a specific type or range of values. The kind of data that variables may hold in a programming language are called as data types. C data types can be classifies into 3 categories.
- Primary data types
- Derived data types
- User defined data types
Primitive Datatypes :
C offers a standard, minimal set of basic datatype. Sometimes these are called primitive datatype. A lot of complex data structures can be developed from these basic data types.
These data type 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.