Data Types

A datatype in C define as a kind of values and the operations that can be performed on those values. Storage representation of  different datatype is different in memory.

There are four fundamental datatypes used in C

  • int is used to store integer value.
  • char is used to store character value.
  • float is used to storing single precision floating point.
  • double is used to storing double precision floating point.

In C, two types of  qualifiers are used with datatype.

  1. Size qualifiers – short, long
  2. Sign qualifiers – signed, unsigned

The qualifier signed and unsigned applied with int and char. unsigned used the number always positive and signed may be positive or negative. The qualifier short and long applied with int and long applied with double.

The size and range of int data type are:

Basic data typesData types with type of qualifiers Size (bytes)Range
intint or signed int
2-32768 to 32767
unsigned int20 to 65535
shot int or signed short int1-128 to 127
unsigned short int10 to 155
long int or signed long int 4-2147483648 to 2147483647
unsigned long int40 to 4294967295

The size and range of char data type are:

Basic data typeData types with type qualifiersSize (bytes)Range
charsigned char1-128 to 127
unsigned char10 to 155

The size and range of float and double data type are:

Basic data typeData types with type qualifiersSize (bytes)Range
floatfloat43.4E-38 to 3.4E+38
doubledouble81.7E-308 to 1.7E+308
long double103.4E-4932 to 1.1E+4932

All character and integer types are known as integral types, and float, double,long double are known as floating point types. The size and range of different data types is machine dependent.

Leave a Reply