Program to Calculate Size of Datatypes in C | Basic Datatypes Size in C

Spread the love

Program Introduction:

Write a C program to calculate the size of datatypes in C Programming language. We will calculate the all in-built datatypes size.

Program Description:

We are going to use the in-built C language sizeof operator to calculate the size of each datatype.

Syntax of sizeof operator:

sizeof operator will take variable as the input and returns the size of that variable (Means size of the variable datatype)

📢 sizeof is an operator but it looks like an function.

Size of the datatypes is compiler dependent. Means depending upon the compiler the size of the datatype will change. For example, Few compilers allocate 2 Bytes for the Integer. And few compilers allocate 4 Bytes for the Integer.

The size is depends on the compiler and compiler memory model implementation. So The output which I got for this program is dependent on my compiler. And your output might be differ from my output.

Program: Size of C Datatypes:

Output Size of C Datatypes Program:

📢 The size of datatypes are compiler dependent. So the output which i have got on my machine might be different from your machine.


In this article, We have written a program to calculate the size of all datatypes in the c programming language.

Related Programs:


Hi Guys, I am Venkatesh. I am a programmer and an Open Source enthusiast. I write about programming and technology on this blog.

You may also like...

Leave a Reply