Different types of Data Types in C Programming

5 min 42 sec read Basic

In this tutorial, we will explore the different data types in  C like Basic Datatypes, Derived Datatypes, Enumeration Datatype, and void data type.

void main() 
    int a = 1; 

What happens in memory when you write

int a = 1;

The compiler will tell itself, Hey, there is a request for me to store variable a with value 1 and as an integer. So, ‘a’ is a variable with the value ‘1’ and since it is an integer, the memory of 2 or 4 bytes will be created for it.

What are Datatypes in C?

Every variable in C programming is associated with one data type like int, float, double, char, etc. depending on which memory is created for that variable. The compiler should know how much memory it should reserve for the variable which is requesting to store some value in its storage.

Types of Datatypes in C

Datatypes in C are divided into four different types:-

1) Basic Datatypes

2) Derived Datatypes

3) Enumeration Datatype

4) void Datatype

Sr. No Datatypes Datatype Description
1) Basic Data Type int, char, float, double
2) Derived Data Type Array, Pointer, Structure, Union
3) Enumeration Data Type enum
4) void a void returns nothing.

Basic Datatypes in C

The size of datatypes in C may vary according to 32-bit or 64-bit architectures. The table includes the size of data types according to 32-bit architecture.:-

C Datatype Size Range
char 1 byte -128 to 127
signed char 1 byte -128 to 127
unsigned char 1 byte -128 to 127
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
int 2 byte(32-bit) & 4 byte(64-bit) -32,768 to 32,767
signed int 2 byte(32-bit) & 4 byte(64-bit) -32,768 to 32,767
unsigned int 2 byte 0 to 65,535
short int 2 byte -32,768 to 32,767
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
float 4 byte 1.2E-38 to 3.4E+38
double 8 byte 2.3E-308 to 1.7E+308
long double 10 byte 3.4E-4932 to 1.1E+4932


Integers are whole numbers that can have both zero, positive and negative values but no decimal values. For example, 0-4, 9

We can use int for declaring an integer variable.

int a = 1;

Here, a is an integer variable with a value initialized to 1.

The size of int is usually 4 bytes (32 bits). 

float and double

float and double are used to hold real numbers.

float a = 1.2;

Here, a is a float variable with a value initialized to 1.2

What is the difference between float and double?

The size of float (single-precision float data type) is 4 bytes. And the size of double (double precision float data type) is 8 bytes.


Keyword char is used for declaring character type variables. For example,

char a = 'h';

The size of the character variable is 1 byte.


void means "nothing" or having "no type". You can think of void as which returns nothing.

For example, if a function is not returning anything, its return type should be void.

Note that, you cannot create variables of type.

signed and unsigned

In C, signed and unsigned are type modifiers. You can alter the data storage of a data type by using them. For example,

unsigned int x;
int y;

Here, the variable x can hold only zero and positive values because we have used the modifier.

Considering the size of int is 4 bytes, variable y can hold values from -231 to 231-1, whereas variable x can hold values from 0 to 232-1

Derived Data Types

Data types that are derived from fundamental data types are derived types. For example arrays, pointers, function types, structures, etc.

We will learn about these derived data types in later tutorials.

How was the tutorial? Nice. Right?

Deep Concept videos to crack the highly-piad interviews.

Chekout out our Youtube Channel to get detailed video content on important topics in interviews.

What is your Interview Score?

Test your skillset with the curated questions created by experts around the globe.

Book a free test slot. Now !.

It usually takes 30 mins for an online test and this test will be MCQ based. Get detailed analytics based on your test and recommedations with personalised roadmaps.

Book a test slot. Now!

Have questions about the trial coding class?

Chat with our experts to discuss

Connect on WhatsApp

Recommended tutorials

#online compiler for c     #python for programming    

#dfs and bfs algorithm     #programming with c language

#storageclass in C    #listcomprehension in python