Data types:
C language is rich in its data types. ANSI supports three classes of data types.
- Primary or fundamental data types.
- Derived data types.
- User-defined data types.
All C compilers support five fundamental data types. Namely, integer (int), character (char), floating point (float), double-precision floating point (double) and void. They are described below.
-
Integer types:Integer are whole numbers with a range of values supported by a particular machine. If we use a 16 bit word length, the size of the integer value is limited to the range -32768 to +32767.C has three classes of integer storage, namely short int, int and long int. Short int represents fairly small value than int and int represents fairly small value than long int.
-
Floating point type:Floating point numbers are stored in 32 bits, with 6 digits of precision. Floating point numbers are defined in C by the keyword float. When float is not sufficient double can be used and when double is not sufficient long double can be used.
-
Void types:The void types has no values. This is usually used to specify the type of functions. The type of a function is said to be void when it does not return any values to the calling function.
-
Character types:A single character can be defined as a character (char) type data. Characters are usually stored in 8 bits of internal storage. While unsigned char have values between 0 to 255, sign char have values from -128 to 127.