Another way to learn New Technology

Fundamental data types and sizes used in C Programming

1 235

Fundamental data types and sizes used in C Programming

ANSI C supports four classes of data types

  1. Primary data types,
  2. User-defined data types,
  3. Derived data types,
  4. Empty data set.

All C compilers support four fundamental data types, namely integer (int), character (char), floating point (float) and double precision floating point (double). Many of them also offer extended data types such as long int and long double.

 

Size and range of Basic data types

     Data Type     

Range of values

char   – 128 to 127
int – 32,768 to 32,767
float 3.4e – 38 to 3.4e + 38
double 1.7e – 308 to 1.7e + 308

 

Integer Types:

Generally, integer occupies one word of storage since the word sizes of machines vary (16 to 32 bits). If we use 16-bit word length, the size of an integer value is limited to – 32768 to 32767. 32-bit word length can store an integer ranging from – 2147 483 648 to 2147 483 647.

Size and range of Data type on 16-bits machine

Type

    Size   

Range

Char or signed char 8 – 128 to 127
unsigned char 8 0 to 255
int or signed int 16 – 32,768 to 32,767
unsigned int 16 0 to 65535
short int or signed short int 8 – 128 to 127
unsigned short int 8 0 to 255
long int or signed long int 32 -2147483648 to 2147483647
unsigned long int 32 0 to 4294967295
float 32 3.4E – 38 to 3.4E + 38
double 64 1.7E-308 to 1.7E + 308
long double 80 3.4E – 4932 to 1.1E + 4932

Click Here : For More C Programming Tutorials