Data types

Back - C Language Notes By Vivek Sir email: vivekdubey22@gmail.com (w) 9826424484

'C' provides various data types to make it easy for a programmer to select a suitable data type as per the requirements of an application. Following are the three data types:

  1. Primitive data types
  2. Derived data types
  3. User-defined data types

There are five primary fundamental data types,

  1. int for integer data
  2. char for character data
  3. float for floating point numbers
  4. double for double precision floating point numbers
  5. void

Array, functions, pointers, structures are derived data types. 'C' language provides more extended versions of the above mentioned primary data types. Each data type differs from one another in size and range. Following table displays the size and range of each data type.

Data type

Size in bytes

Range

Char or signed char

1

-128 to 127

Unsigned char

1

0 to 255

int or signed int

2

-32768 to 32767

Unsigned int

2

0 to 65535

Short int or Unsigned short int

2

0 to 255

Signed short int

2

-128 to 127

Long int or Signed long int

4

-2147483648 to 2147483647

Unsigned long int

4

0 to 4294967295

float

4

3.4E-38 to 3.4E+38

double

8

1.7E-308 to 1.7E+308

Long double

10

3.4E-4932 to 1.1E+4932

Note: In C, there is no Boolean data type.

 

Back - C Language Notes By Vivek Sir email: vivekdubey22@gmail.com (w) 9826424484