Void functions calls do NOT return a value, so there isn't a variable or equal sign in front of the function call.
displayHeadings(rate, hours, gross);
A pointer is the memory address of a variable.
A pointer variable is a special type of variable that can store a memory address instead of a payRate or hoursWorked.
Pointer variables are declared using an asterisks;
int regularInt; // variable for integer value
int *pointerInt; // pointer for an integer
Use an asterisk * in front of the pointer to reference the value stored in the location it points to.
Use an ampersand & in front of a regular variable to get its memory address.
In a call-by-value function, values of the arguments are passed through the function's parameters.
Many values can be passed to the functions, but only one value can be returned through the return statement.
In a call-by-reference function, addresses of the arguments are passed through the function's parameters.
Many values can be passed to the functions, and many values can be returned.
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.
In a function declaration, the formal parameters can be a mixture of call-by-value and call-by-reference.
A function that returns no value is called a void function.
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.
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.
The precondition states what is assumed to be true when the function is called.
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.
All subtasks in a program can be implemented as functions, either as functions that return a value or as void functions.
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.
In a call-by-value, the value of an argument is substituted for its corresponding formal parameter.
In a call-by-reference, the argument should be a variable and the entire variable is substituted fo rthe corresponding argument.
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.
An argument corresponding to a call-by-value parameter cannot be changed by a function call.
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.
Every function should be tested in a program in which every other function in that program has already been fully tested and debugged.
A driver program is a program that does nothing but test a function.
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.
A debugger, strategic placement of cout statements, and the assert macro are tools that can help you debug a program.