O'Reilly logo

Sams Teach Yourself C++ in 24 Hours, Third Edition by Jesse Liberty

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

Functions

Although main() is a function, it is an unusual one. Your operating system invokes main() to start your program. Other functions are called, or invoked, from main() or from one another during the course of your program.

The function main() always returns an int. As you'll see in the coming hours, other functions might return other types of values or might return nothing at all.

A program is executed line by line in the order it appears in your source code, until a function is called. Then the program branches off to execute the function. When the function finishes, it returns control to the line following where the program called the function.

Imagine that you are drawing a picture of yourself. You draw the head, the eyes, the nose, ...

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