Tuesday, 14 December 2010

call by value

Call By Value:

Actual parameters are to the function. Whatever the modifications are done in function, those changes are not reflects in calling function.

Ex: add(a,b);
Example Program:
void main()
{
 int add(int,int);
 int a,b,c;
 a=2;
 b=3;
 c=add(a,b); //calling function
 printf("c=%d\n",c);
}
int add(int a,int b)
{
  int c;
  c=a+b;
  return(c);
}



No comments:

Post a Comment