Data type

DATA TYPES

C language is rich in its data types. Storage representations and machine instructions to handle constants differ from machine to machine. The variety of data types available allow the programmer to select the type appropriate to the needs of the application as well as the machine. 

ANSI C supports three classes of data types.

1. Primary (or fundamental) data types
2. Derived data types
3. User-defined data types

The primary data types and their extensions are discussed in this section. The user-defined data types are defined in the next section while the derived data types such as arrays, functions, structures and pointers are discussed as and when they are encountered.

All C compilers support five fundamental data types, namely integer (int), character (char), floating point (float), double-precision floating point (double) and void. Many of them also offer extended data types such as long int and long double. Various data types and the terminology used to describe them are given in Fig. 2.4. The range of the basic four types are given in Table 2.7. We discuss briefly each one of them in this section.

                                 Primary Data Types
         
                                      Integral type

                   Integer                                            Character 
Signed                  Unsigned                          char 
Int                      unsigned int                        signed char   
Short int          unsigned short int             unsigned char
Long int            unsigned long int 

          Floating point type                                       void
Float           Double        Long double           




Posted on by