Chapter 11


  1. A pointer is a variable or constant whose value is the address of another variable or constant.

  2. Dynamic memory allocation requires a pointer to be performed.

  3. The only difference between declaring an integer variable and an integer pointer variable is that the pointer variable declaration includes an asterisk, which either follows the data type or precedes the variable name .

  4. The data type in the declaration of a pointer refers to the data type of another variable (or constant) whose memory address is the value of the pointer.

  5. NULL is a constant defined in several standard libraries, including iostream . You assign a pointer NULL if it is too early in your code to know which address to assign to the pointer. The value of NULL, the memory address 0, signals that the pointer is not intended to point to an accessible memory location.

  6. You use the address operator to assign a pointer the address of another variable or constant.

  7. The purpose of the indirection operator is to obtain the value of the variable or constant to which the pointer points. This operation is said to dereference the pointer.

  8. A pointer may point to different memory addresses at different times in the program if the pointer is declared as a variable instead of as a constant.

  9. Yes. More than one pointer may point to the same memory address.

  10. Incrementing a pointer variable increases its value by the number of bytes of its data type.

  11. The purpose of the new operator is to dynamically allocate memory. The purpose of the delete operator is to deallocate dynamically created memory.




C++ Demystified(c) A Self-Teaching Guide
C++ Demystified(c) A Self-Teaching Guide
ISBN: 72253703
EAN: N/A
Year: 2006
Pages: 148

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net