
Prelab Activities
Review
When a function invokes itself, the call is known as a recursive call. Recursion—the
ability of a function to call itself—is an alternative control structure to repetition
(looping). Rather than use a while statement, do-while statement, or for statement to
execute a segment of code again, the program uses a selection statement (if or switch
statement) to determine whether to repeat the code by calling the function again or to
stop the process.
Each recursive solution has at least two cases: the base case and the general case.
The base case is the one to which we have an answer; the general case expresses the
solution in terms ...