Chapter 7. Creating and Using Functions

  • Learn about various types of functions

  • Understand function return types and values

  • Find out how to create your own functions

  • Discover how to use command-line arguments

  • Find out how to use variable-argument lists

  • See how to make functions reusable with modules


Why Use Functions?

Functions are extremely important in C++, and any real C++ program will have at least one custom function designed to perform some of the program’s work. By creating your own functions, you open the door to an endless world of possibilities. In this chapter, you’ll see how to conceptualize and write your own functions. You’ll also see how to pass data to the functions, process this data, and return a useful result to ...

Get Practical C++ now with O’Reilly online learning.

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