C++ Function

A function is a set of statements that executes a task. In C++, functions are categorized into two different categories on behalf of argument (parameter) pass.

  1. Function with parameter (return_type function_name(paramenter);)
  2. Function without parameter (return_type function_name();)

Function which takes parameter in function is called function with parameter. A function which does not take parameter in function is called function without parameter.

Function with a parameter has further categorized into two different categories.

  1. Call by value
  2. Call by reference.

C++ call by value

In call by value function, action performed is done over the copy of actual value pass in the parameter. So that in call by value the actual value of the program never affected. The action on value is performed on the current function.

C++ call by value Example


Pin It on Pinterest

Share This