Chapter 9


  1. A variables scope determines where it can be referred to in the code. A variables lifetime determines when it is destroyed .

  2. No. A function other than main does not have to be prototyped if it is defined above where it is called. However, it is a good idea to prototype each function other than main.

  3. No. A function need not have any arguments. If it has none, then the void keyword may be used in the parentheses following the function name .

  4. Yes. A function may have more than one argument. If so, the arguments are separated by commas.

  5. If a variable in main is passed by value to another function which changes the argument corresponding to that variable, the variable in main is not changed.

  6. If a variable in main is passed by reference to another function which changes the argument corresponding to that variable, the variable in main is changed.

  7. No. A function does not have to have a return value. If it doesnt have a return value, the keyword void is used in its place.

  8. No. A function may not have more than one return value.

  9. Yes. A function does not have to have a return value nor any arguments.

  10. Yes. A function may have both a return value and arguments.




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