Data Type in C language
Datatype is a type of data which is used in the program. In other word we can say that it is used to declare a variable. Datatype specify how we entred data in our program and what type of fata we entered.
There are two types of Data Types :-
1. Premitive Data Type
2.Derived Data Type
- array
- pointer
- structure
- union
The sizes of the Data Types are shown below.
Data Types |
Memory Size |
Range |
int |
2 byte |
-32,768 to 32,767 |
unsigned int |
2 byte |
0 to 65535 |
long |
4 byte |
-2,147,483,648 to 2,147,483,647 |
char |
1 byte |
-128 to 127 |
unsigned char |
1 byte |
0 to 255 |
float |
4 byte |
3.4e-038 to 3.4e+038 |
double |
8 byte |
1.7e-308 to 1.7e+308 |
long double |
10 byte |
1.7e-4932 to 1.7e+4932 |
Format specifiers in console formatted I/O functions
Some of the most commonly used format specifiers in input/output functions to display data types in C language are displayed in the table below -
Format Specifiers |
Description |
%d |
Format specifier used to read or display a signed int integer value. |
%ld |
Format specifier used to read or display a signed int integer value. |
%c |
Format specifier used to read or display a long integer value or signed long integer value. |
%f |
Format specifier used to read or display a float, floating-point value. |
%lf |
Format specifier used to read or display a double, floating-point value. |