Function Review

First, let's review what you've already seen about functions. To use a C++ function, you must do the following:

  • Provide a function definition.

  • Provide a function prototype.

  • Call the function.

If you're using a library function, the function already has been defined and compiled for you. Also, you can use a standard library header file to provide the prototype. All that's left to do is to call the function properly. The examples in this book have done that several times. For example, the standard C library includes the strlen() function for finding the length of the string. The associated standard header file cstring contains the function prototype for strlen() and several other string-related functions. This advance work allows ...

Get The Waite Group's C++ Primer Plus, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.