Defining a Function

Learn how to define your own function in C++.

Function definition

A function’s definition tells what a function will do when it is called. The basic syntax for defining a function in C++ is:

We have already discussed the return_type, function_name, and function_parameters in the previous lesson. Let’s discuss the function_body.

function_body

A function body consists of a group of ...