6. Functions and an Introduction to Recursion

Objectives

In this chapter you’ll:

• Construct programs modularly from functions.

• Use common math library functions.

• Pass data to functions and return results.

• Learn how the function call and return mechanism is supported by the function call stack and activation records.

• Use random number generation to implement game-playing applications.

• Learn how the visibility of identifiers is limited to specific regions of programs.

• Write and use recursive functions.

Get C++11 for Programmers, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.