Home >>C Tutorial >Data Types in C

Data Types in C

Data Types in C

There are various data types in C and the main function is to specify the type of data that can be stored by a variable like integer, floating, character, etc.
Here are the following data types in the C language:

Types Data Types
Basic Data Type int, char, float, double
Derived Data Type array, pointer, structure, union
Enumeration Data Type enum
Void Data Type void

Basic Data Types in C

The basic data types in C languages are integer-based and floating-point based. C language is known to support both signed and unsigned literals.

Please note that the memory size of the basic data types in C language may change according to 32 or 64-bit operating system.

Here are some of the basic data types.
The points to be noted is that the size is given according to 32-bit architecture.

Data Types Memory Size Range
char 1 byte −128 to 127
unsigned char 1 byte 0 to 255
signed char 1 byte −128 to 127
short 2 byte −32,768 to 32,767
unsigned short 2 byte 0 to 65,535
signed short 2 byte −32,768 to 32,767
int 2 byte −32,768 to 32,767
short int 2 byte −32,768 to 32,767
signed int 2 byte −32,768 to 32,767
unsigned int 2 byte 0 to 65,535
unsigned short int 2 byte 0 to 65,535
signed short int 2 byte −32,768 to 32,767
signed long int 4 byte -2,147,483,648 to 2,147,483,647
long int 4 byte -2,147,483,648 to 2,147,483,647
long double 10 byte
unsigned long int 4 byte 0 to 4,294,967,295
float 4 byte
double 8 byte

No Sidebar ads