This article covers the 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.


1:1 & 1:Many Mentorship Program

Be job-ready. Learn how to crack the interviews with industry ready training program.

Learn More

Data Structures & Algorithms

What is Dynamic Programming and how to use it

This is a quick introduction to Dynamic Programming.

3 ways to check anagrams

Let's discuss the 3 ways to check anagrams and their time complexity.

Bubble Sort Algorithm

Topics covered: 1) Basics of Bubble Sort Algorithm 2) Worst Case, Best Case complexity

Introduction to Trees

What is a Tree and Terminologies like root, sibling, parent node, children, Leaf node, Ancestor & Descendant, Properties of Tree Data Structure, Depth of node, Height of node

Address Calculation in 2d array

Let's discuss about the Address Calculation using row-major order & column-major order.


Javascript - Postfix Vs Prefix

Let's discuss the difference between postfix and prefix with a practical example.

Javascript Identifiers, Variables

In this session, we will discuss the concept of identifiers, variables and operators in javascript with a practical example.


Bootstrap 4 Tutorial: Modal Popups Made Easy | Live Demo

Let's discuss the Modal Popups in Bootstrap.

How to create a dropdown list in navbar bootstrap

In this video, we will discuss How to create a dropdown list in navbar bootstrap with a practical example.

Navigation tabs in Bootstrap

Let's discuss about the navigation tabs in Bootstrap

Bootstrap Buttons

Let's discuss about the button classes in bootstrap.

Recommended tutorials