Function in C++

Syntax:

return will work for any function_type except void….void does not return any value but it returns..so we can use return keyword in void to exit but no value after return keyword  in void method / function

Normally we have to declare function protoype if we add the calling function after the main function

We can also use without function prototype when main function is after the calling function

We can also use function when there is not equal parameter is passing like

One example below created by me:

Another example

Recursive function: Factolrial
courtesy:cplusplus.com

Another one:

 

C++ Functioon Call By Value

 

C++ Function call by Reference

C++ Function call by Pointer