Functions-Example for function definition

Example for function definition :

int Add(int a, int b)
{

int c;

c=a+b;

return c;

}

In the above function, in the first line of definition int indicates that function returns integer value, Add is the name of function and 'a' 'b' are parameters. Inside the body of function 'c' is declared of type int as a local variable. The last statement return is sending the value of variable c to calling function. 

Comments