Skip to Main Content
C++ Programming: Visual QuickStart Guide
book

C++ Programming: Visual QuickStart Guide

by Larry Ullman, Andreas Signer
December 2005
Beginner content levelBeginner
528 pages
14h 13m
English
Peachpit Press
Content preview from C++ Programming: Visual QuickStart Guide

5. Defining Your Own Functions

The premise behind any function in any language is simple: encapsulate a process under one name. Then, by calling that name (i.e., invoking the function), you can repeat that sequence of steps with ease. You’ve already seen this in action when you use the functions defined in C++, like cin.get() or the close() function used with files. In this chapter you’ll learn how to define and call your own functions.

The syntax for defining a function is simple and consistent, but there are many permutations as to what a function can do. For starters, you’ll create a simple function, one that takes no arguments and returns no values. Then you’ll begin writing functions that take required arguments, and then those that take ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

C Programming: Visual Quickstart Guide

C Programming: Visual Quickstart Guide

Larry Ullman, Marc Liyanage

Publisher Resources

ISBN: 032135656XPurchase book