Four keywords out of 32 pre-defined keywords of C Language are used to specify the type of data of a data element or data acceptable or return by a function element. The four keywords are int, char, float and double.
The data type will be used at the time of declaration of a data element like variable, constant, array etc. Moreover, the data type is also used at the header of a function definition to specify the type of data a function can intake or the type of data that a function can return.
The following are the examples of usage of data types:
int a;
float a,b;
int add(int x, int y){….}
Basically a datatype specifies three things:
- Memory requirement
- Range of values
- Type of operations
DATA TYPE TYPE OF DATA MEMORY RANGE
Int Integer 2 Bytes − 32,768 to 32,767
Char character 1 Byte − 128 to 128
Float Floating point number 4 bytes 3.4e − 38 to 3.4e+38
Double Floating point number
with higher precision 8 bytes 1.7e − 308 to 1
Modifiers/Qualifiers for Data type:
Data type Size (bytes) Range
Short int/ int/signed int 2 −32768 to 32,767
Long int 4 −2147483648 to 2147483647
Unsigned int 2 0 to 65535
Signed char 1 −128 to 127
Unsigned char 1 0 to 255