Data Types in C Language

Four keywords out of 32 pre-defined keywords of C Language are used to specify the type of data of a data element or data acceptable or return by a function element.  The four keywords are int, char, float and double.

The data type will be used at the time of declaration of a data element like variable, constant, array etc.  Moreover, the data type is also used at the header of a function definition to specify the type of data a function can intake or the type of data that a function can return.

The following are the examples of usage of data types:

int a;

float a,b;

int add(int x, int y){….}

Basically a datatype specifies three things:

  1. Memory requirement
  2. Range of values
  3. Type of operations

 

DATA TYPE                     TYPE OF DATA         MEMORY          RANGE

            Int                          Integer                         2 Bytes                − 32,768 to 32,767

            Char                       character                      1 Byte                 − 128 to 128

            Float                      Floating point number   4 bytes                3.4e − 38 to 3.4e+38

            Double                   Floating point number

                                          with higher precision     8 bytes                1.7e − 308 to 1

You cannot copy content of this page