Data Types in C language

Data type is the defining the type of the data. The C program supports different data types. Each data type may have predefined memory requirement and storage representation.

It is divided into 4 types. They are

Primary or Basic datatypes

The char, int, float, double are the different datatypes in primary datatypes.

Empty type

The datatype void belongs to this category.

Derived types

Arrays, pointer, structure, union, functions belong to this category.

Enumerated types

They are used to define variables that can only assign certain discrete integer values throughout the program.

Integer Type

Integers are used to store whole numbers. Size and range of Integer type on 16-bit machine.

TYPE SIZE(bytes) RANGE
int or signed int 2 -32,768 to 32767
unsigned int 2 0 to 65535
short int or signed short int 1 -128 to 127
unsigned short int 1 0 to 255
long int or signed long int 4 -2,147,483,648 to 2,147,483,647
unsigned long int 4 0 to 4,294,967,295

Floating Point Type

Floating types are used to store real numbers. Size and range of Integer type on 16-bit machine.

TYPE SIZE(bytes) RANGE
Float 4 3.4E-38 to 3.4E+38
double 8 1.7E-308 to 1.7E+308
long double 10 3.4E-4932 to 1.1E+4932

Character Type

Character types are used to store characters value. Size and range of Integer type on 16-bit machine.

TYPE SIZE(bytes) RANGE
char or signed char 1 -128 to 127
unsigned char 1 0 to 255

Void Type

The void type means no value. This is usually used to specify the type of functions which returns nothing. We will get acquainted to this datatype as we start learning more advanced topics in C language, like functions, pointers etc.


Most Read