In this tutorial, you will learn about what is data types and different types of data types such as int, float, char, etc. available in C programming language.
A data type refers the type of data that a variable can hold such as int
, float
, character
, etc. This also determines the size of the data that a variable can hold in C programming language. For example,
int var1;
Here, var1
is a variable of int
(integer) type and the size of the int
is 4 bytes.
There are following data types available in C programming language.
Data Types | Data Types Example |
Basic Data Type | int, float, char, double |
Derived Data Types | array, pointer, structure, union |
Enumeration Data Type | enum |
Void Data Type | void |
Basic Data Types
Basic data types in C programming language mainly based on integer-based and floating-point based. C language supports both singed ang unsigned datatypes.
The size of the each data type differs based on the operating system architecture.
Here, we have mentioned most commonly used basic data types in C programming language base on 32-bit architecture.
Data Types | Memory Size | Range |
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 |
short int | 2 byte | −32,768 to 32,767 |
signed short int | 2 byte | −32,768 to 32,767 |
unsigned short int | 2 byte | 0 to 65,535 |
long int | 4 byte | -2,147,483,648 to 2,147,483,647 |
signed long int | 4 byte | -2,147,483,648 to 2,147,483,647 |
unsigned long int | 4 byte | 0 to 4,294,967,295 |
char | 1 byte | −128 to 127 |
signed char | 1 byte | −128 to 127 |
unsigned char | 1 byte | 0 to 255 |
short | 2 byte | −32,768 to 32,767 |
signed short | 2 byte | −32,768 to 32,767 |
unsigned short | 2 byte | 0 to 65,535 |
float | 4 byte | |
double | 8 byte | |
long double | 10 byte |