Zebra0.com

cpp functionsIntroduction to C++ Programming

Introduction to C++ Programming

Learn C++ in step-by-step lessons.

Functions

A function is a block of code that has a name, a return type and a list of arguments. Every C++ program has at least one function: main. Execution of a program always starts with main. The function main usually makes calls to other functions. In this lesson you will learn to write your own functions, and call them. One use for functions is to break a program into separate functions to improve the readability of a program and to create functions that can be used in other programs. Each function should have a clearly defined purpose. Each function should also have a comment to explain its purpose.

Please study the material at each of the links below.

  1. A function half A function half
    /cpp/videos/function-half.mp4

  2. Function prototypes Function prototypes
    /cpp/videos/function-prototypes.mp4
  3. A function to print area

  4. A function area with prototype

  5. A leap year function A leap year function
    /cpp/videos/cpp-leapyear.mp4
GlossaryGlossary for functions lesson
Full Glossary