Chapter 3

  1. Declaring a variable reserves memory for the storage of information and provides a name by which that information later can be referred to in code.

  2. No. An undeclared identifier compiler error will occur even though the variable is declared after it is referred to because the compiler reads the code from top to bottom, so when it reaches the first reference to the variable, it has not seen the variable declaration.

  3. Yes, as long as the variables are of the same data type.

  4. A naming convention is a consistent method of naming variables.

  5. The address operator is used to obtain the hexadecimal value of a variable's memory address, whereas the size of operator is used to determine the number of bytes in memory required to store the variable.

  6. Initialization is when you assign a value to a variable as part of the same statement that declares that variable.

  7. Overflow occurs when a variable is assigned a value too large for its range.

  8. A compiler error is the consequence of using an assignment operator to assign a string value to an integer variable.

  9. You use the cin object for run-time assignment of values to variables.

  10. Yes. You can use one cin statement to assign values to several variables of different data types.

C++ Demystified(c) A Self-Teaching Guide
C++ Demystified(c) A Self-Teaching Guide
ISBN: 72253703
Year: 2006
Pages: 148 © 2008-2017.
If you may any questions please contact us: