What is function in c ?What is Call by value and Call by reference passing ?

In computer programming, a function is a sequence of program instructions that performs certain task, bundled as a unit. This bundle can then be used in programs whenever that particular task should be performed. Function may be defined within a program or can be used from library that can be used by multiple programs.

The content of a function is its body, body is executed when the function is called. A function may be written such a way that it requires some information from calling program, that values may be passed  as function arguments. A function may also return a computed value to its caller.

Function declaration :

return_type function_name(arguments..){

statements;

}

Convention

Description

Call by Value Argument is evaluated and copy of the value is passed to function
Call by Reference Reference to argument , generally its address is passed (using pointer)

 

%d bloggers like this: