1.Types of DataTypes in C?
- Primitive data type
- Derived data type
- User defined data type
  Primitive data type
                  char, int,
    float, double
  Derived data type
                  signed/unsigned char, signed/unsigned
    int, signed/unsigned long, long double
  User defined data type
                  structure,
    union, Enum, array
  Below range & format specifier are based on 32 bit gcc compiler.
| DATA TYPE | MEMORY (BYTES) | RANGE | FORMAT SPECIFIER | 
| signed char | 1 | -128 to 127 | %c | 
| unsigned char | 1 | 0 to 255 | %c | 
| short int | 2 | -32,768 to 32,767 | %d | 
| unsigned short int | 2 | 0 to 65,535 | %u | 
| unsigned int | 4 | 0 to 4,294,967,295 | %u | 
| int | 4 | -2,147,483,648 to 2,147,483,647 | %d | 
| float | 4 | 1.2E-38 to 3.4E+38 | %f | 
| double | 8 | 2.3E-308 to 1.7E+308 | %lf | 
  To Find:
              For signed data types, 
                      -2^(n-1) to (2^(n-1))-1
              For unsigned data types, 
                      (2^n) – 1 
  If we are minded the above formula we can easily find the range of
    datatype.
 

0 Comments