4.5. SummaryΒΆ
Like Python, C++ supports the use of functions.
In C++, a function definition requires a name, a group of parameters, a return type, and a body.
Non-fruitful functions in C++ must contain the keyword
void
in its function definition.You can pass variables by value as well as by reference in C++ functions. Passing by reference utilizes the use of pointers.
Pass by reference is useful when you require a function to return multiple variables.
To pass an array to a function you need to use an array parameter. The array parameter is denoted by the array variable name followed by set of square brackets ([ and ]).
You have attempted of activities on this page