Lesson 02: Data Types and Variables

 

C/C++ offers the programmer a rich assortment of built-in data types. Programmer-defined data types can be created to fit virtually any need. Variables can be created for any valid data type. Also, it is possible to specify constants of C/C++'s built-in types. In this lesson, various features relating to data types, variables, and constants are discussed.

 

Questions

  1. What does the "One Definition Rule (ODR)" mean?
  2. Declare 3 Integer Type & 3 float type Variables.
    INTFLOAT
  3. Examine the following C assignment statements, and find the final value for each variable.
    1. int a = (32 / 5)  % 4 + 2;
    2. int b = (17 - 11) / 3 + 3;
    3. int c = 5 / 2 - 5 % 2;
    4. float d = 3.5 + 3 / (2 + 3);
    5. int e = 3 * 2 / 10.0;
  4. What does the following declaration mean?
    1. int id [] [];
    2. int (* id []) ();
    3. int (* id () ) ();