C++ Chapter 5: Functions for all Subtasks

Home > Preview

The flashcards below were created by user senator77 on FreezingBlue Flashcards.

  1. Void functions calls do NOT return a value, so there isn't a variable or equal sign in front of the function call.
    i.e. displayHeadings();
    displayHeadings(rate, hours, gross);
  2. A pointer is the memory address of a variable.
  3. A pointer variable is a special type of variable that can store a memory address instead of a payRate or hoursWorked.
  4. Pointer variables are declared using an asterisks;

    int regularInt; // variable for integer value
    int *pointerInt; // pointer for an integer
  5. Use an asterisk * in front of the pointer to reference the value stored in the location it points to.
  6. Use an ampersand & in front of a regular variable to get its memory address.
  7. In a call-by-value function, values of the arguments are passed through the function's parameters.
  8. Many values can be passed to the functions, but only one value can be returned through the return statement.
  9. In a call-by-reference function, addresses of the arguments are passed through the function's parameters.
  10. Many values can be passed to the functions, and many values can be returned.
  11. In a call-by-reference function, addresses of the arguments are passed through the function's parameters instead of the values store in the arguments.
  12. In a function declaration, the formal parameters can be a mixture of call-by-value and call-by-reference.
  13. A function that returns no value is called a void function.
  14. With a call-by-reference formal parameter, the corresponding argument in a function call must be a variable and this argument variable is substituted for the formal parameter.
  15. The way that you indicate a call-by-reference parameter is to attach the ampersand, &, to the end of the type name in the formal parameter list in both the function declaration and the header of the function definition.
  16. The precondition states what is assumed to be true when the function is called.
  17. The postcondition describes the effect of the function call, that is, the postcondition tells what will be true after the function is executed in a situation in which the precondition holds.
  18. All subtasks in a program can be implemented as functions, either as functions that return a value or as void functions.
  19. A formal parameter is a kind of place holder that is filled in with a function argument when the function is called. There are 2 methods of performing this substitution, call-by-value and call-by-reference.
  20. In a call-by-value, the value of an argument is substituted for its corresponding formal parameter.
  21. In a call-by-reference, the argument should be a variable and the entire variable is substituted fo rthe corresponding argument.
  22. The way to indicate a call-by-reference parameter in a function definition is to attach the ampersand sign, &, to the type of the formal parameter.
  23. An argument corresponding to a call-by-value parameter cannot be changed by a function call.
  24. An argument corresponding to a call-by-reference parameter can be changed by the function call. If you want a function to change the value of a variable, then you must use a call-by-reference parameter.
  25. Every function should be tested in a program in which every other function in that program has already been fully tested and debugged.
  26. A driver program is a program that does nothing but test a function.
  27. A simplified version of a function is called a stub. A stub is used in place of a function definition that has not yet been tested so that the rest of the program can be tested.
  28. A debugger, strategic placement of cout statements, and the assert macro are tools that can help you debug a program.

Card Set Information

C++ Chapter 5: Functions for all Subtasks
2012-02-17 22:39:54
void functions call reference procedural abstraction testing debugging

C++ Chapter 5: Functions for all Subtasks
Show Answers:

What would you like to do?

Home > Flashcards > Print Preview