web analytics

What are the data types of C?

Data types:

C language is rich in its data types. ANSI supports three classes of data types.

  1. Primary or fundamental data types.
  2. Derived data types.
  3. 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.
           
  1. 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 intint and long intShort int represents fairly small value than int and int represents fairly small value than long int.

  2. 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.

  3. 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.
  4. 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.


Please follow and like us:
Pin Share
RSS
Follow by Email
Scroll to Top