< Previous | Contents | Next >
You call your own functions the same way you call any other function—by writing the function’s name followed by a pair of parentheses that encloses a valid list of arguments. In main(), I call my newly minted function simply with:
instructions();
This line invokes instructions(). Whenever you call a function, control of the program jumps to that function. In this case, it means control jumps to instructions() and the program executes the function’s code, which displays the game instructions. When a function finishes, control returns to the calling code. In this case, it means control returns to main(). The next statement in main () (return 0;) is executed and the program ends.
Using Parameters and Return Values 155