Data Types of C


Data Types is useful in programming language to instruct compiler that which kind of value can be contained in the variable. Weather it can be integer, floating point or character.
Each type of value required different amount of memory space. Thus data types also instruct compiler to allocate appropriate amount of memory to hold the value of particular variable.
Following are the various categories of Primary Data Types of C Language.

Primary (Basic) Data Types

Following are the various categories of Primary Data Types of C Language.
(1) Integer Data Type:
This category of data type represents numeric value without any decimal point. It is used to represent whole number.
In this category we can also specify type modifier along with data type. Type modifier allows us to increase or decrease the range of value that can be stored. In C language we can use short and long type modifier.

We can also use type modifier to represents number as a positive or negative. By default each data type is signed, means they can hold positive as well as negative numbers. In C Language we can use signed and unsigned type modifier.
Following are the Data Types contained in this category:

Data Type Size in Bytes Range
short int 1 -128 to 127
unsigned short int 1 0 to 255
int 2 -32768 to 32767
unsigned int 2 0 to 65535
long int 4 -2147483648 to 2147483647
unsigned long int

4 0 to 4294967295
     

(2) Floating Point data Type:
This category of data type represents number with decimal point.
Following are the Data Types contained in this category:

Data Type Size in Byte Range
Float 4 3.4 E-38 to 3.4E +38
Double 8 1.7 E-308 to 1.7 E + 308
Long Double 10 3.4 E -4932 to 3.4 E +4932

(3) Character Data Type:
This category of data type represents single character.
Following are the Data Types contained in this category:

Data Type Size in Byte Range
char 1 -128 to 127
unsigned char 1 0 to 255

(4) Void Data Type:
This category of data type represents blank (null) value.
So it is not used to declare any variable. It is used to represent return type for the function that does not return any value.

 

Download Projects


Download Programs