What is Datatype?

Data type is used for declaring the type of a variable. The type of variable determines how much size will it occupie in storage. C support three classes of data types:

  1. Primary data type.
  2. Derived data type.
  3. User-defined data type.

Primary data types that are available in C are:

Integer Type
int is used to define Integer variables. The size of integer data type is 2 bytes or 16 bits. The range for signed integer is -32,768 to 32,767.
Integer variable can be declared as follows:
int tech;
int val = 23;

character Type
char is used to define Integer variables. The size of char data type is 1 byte or 8 bits. The ASCII range of character is -128 to 127.
char c;

floating Type
float is used to define Integer variables. The size of float data type is 4 bytes or 32 bits. The range of float is 3.4E-38 to 3.4E+38.
float f;
f = 2.6;

double Type
double is used to define Integer variables. The size of double data type is 8 bytes or 64 bits. The range is 1.7E-308 to 1.7E+308.
double d;
d = 3.14;

The void type has no values. This is used to define the return type of function. The function with void return type does not return any value to the calling function.

Derived Data type includes following :
  • Pointer
  • Array
  • Structure
  • Union

User-Defined Type Declaration:

A User definied data is a data type that derived from an existing primitive data type. It is used to create customized data type when the name of data type become long or slightly complicated. “Typedef” is used to create user defined data type.
typedef int chirag;
chirag name1,name2;
typedef float sachin;
sachin v1,v2;

Here chirag symbolize “int” and sachin symbolize “float”.
chirag and sachin can be further used as a data type.

name1,name2 is used as “int” variable.
v1,v2 is used as “float” variable.

Size and range of datatype:

Data Types Range in C

Datatypes, their Keywords and format specifiers:

Format Specifiers in C



Integer values
32767 32768 32987

Long integer value
32767 67890 32556



m is 534545
n is 1234567890
x is 1.223546386
x is 1.223546
y is 9.87766
y is 9.877665
k is 54321
p is 1.000000
q is 1.000000000000

Escape sequence

Some characters are not the part of characters set. An Escape sequence is a sequence of characters that does not represent itself when used inside a string literal.

All escape sequences consist of two characters:
  1. The first of which is the backslash, \ (called the "Escape character")
  2. the remaining characters determine the interpretation of the escape sequence.

Escape Sequences in C

Key points

Do You Know?