Home / Computer Science / C Language / Data types in C Language

Data types in C Language

Data types in C:

C has different types of data types. The data type is determines how much space is occupied by variable in the storage disk.

Mainly there are two types those are Pre- defined and User Defined.

Basic data types: These are arithmetic data types Integer, Char, float and Double.

Enumerated Type: enum is the arithmetic type used to define variables used to assign certain discrete integer values throughout the program.

Void data type: Void means no value.

Derived Data types: Derived data type means these are defined by the programmer at the time of programming based on the requirement.

Arrays, pointers, structures and union.


Data Types in C:


Data Types Size Range
Char 1 byte −128 to 127
signed char 1 byte −128 to 127
unsigned char 1 byte 0 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 32,767
Int 2 byte −32,768 to 32,767
signed int 2 byte −32,768 to 32,767
unsigned int 2 byte 0 to 32,767
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 32,767
long int 4 byte
signed long int 4 byte
unsigned long int 4 byte
Float 4 byte
Double 8 byte
long double 10 byte


The above shows the basic data types in c.

Note: If you want to know the exact size of the variable or a type use sizeof() operator .

Below program demonstrates how to use sizeof() operator in c and know the values of basic data types.

This is basic interview question for fresher use of sizeof() operator.



void main(){

printf(“size of an integer: %d \n”,sizeof(int));

printf(“size of float: %d \n”,sizeof(float));

printf(“size of Character: %d \n”,sizeof(char));

printf(“size of double: %d \n”,sizeof(double));




Output is :

size of an integer:2

size of float: 4

size of Character:1

size of double: 8

Press  Alt +f9 and then Ctrl+f9 to compile and run the program.


Out put of the above program is:


About GSK

Hi, i am Santosh Gadagamma, a tutor in Software Engineering and an enthusiast for sharing knowledge in Computer Science and other domains. I developed this site to share knowledge to all the aspirants of technologies like, Java, C/C++, DBMS/RDBMS, Bootstrap, Big Data, Javascript, Android, Spring, Hibernate, Struts and all levels of software project design, development, deployment, and maintenance. As a programmer I believe that, "The world now needs computers to function." Hope, this site guides you as a learning tool towards greater heights. I believe that Education has no end points and i wish to learn more in the process of teaching you.

Check Also

Features of C language

WHERE is C Used Let us now see how does C compare with other programming …