O'Reilly logo

C++ for the Impatient by Brian Overland

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 5. Functions

One of the key elements of most any programming language is that of function—which other languages sometimes refer to as “subroutine,” “procedure,” or “subprogram.” It’s a semiautonomous part of the program you can transfer control to and come back from.

Some languages have a different syntax for subroutines that return values as opposed to those that don’t. But C++ considers them all functions whether they return a value or not.

read_in_file("readme.txt");   // Call read_in_file funct.

Traditionally, in C++ you must declare a function and give it a name before calling it. Most of this chapter describes that traditional approach.

The new C++11 specification also supports a new syntax called lambda, or anonymous, functions—functions ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required