[prev] 54 [next]

Basic Data Types

  • In C each variable must have a type
  • C has the following generic data types:

    char   character   'A', 'e', '#', …
    int   integer   2, 17, -5, …
    float   floating-point number   3.14159, …
    double   double precision floating-point   3.14159265358979, …

    There are other types, which are variations on these

  • Variable declaration must specify a data type and a name; they can be initialised when they are declared:

    float x;
    char  ch = 'A';
    int   j = i;