In call by value the values of the variables are passed. In this value of variable are not
affected by changing the value of the formal parameter.
void main()
{
int a = 5;
int b = 8;
clrscr();
printf("Before Calling the function a and b are %d and %d \n", a,b);
value(a,b);
printf("After Calling the function a and b are %d and %d \n", a,b);
getch();
}
value(int p, int q)
{
p++;
q++;
printf("In the function p and q are %d and %d \n", p,q);
}
affected by changing the value of the formal parameter.
void main()
{
int a = 5;
int b = 8;
clrscr();
printf("Before Calling the function a and b are %d and %d \n", a,b);
value(a,b);
printf("After Calling the function a and b are %d and %d \n", a,b);
getch();
}
value(int p, int q)
{
p++;
q++;
printf("In the function p and q are %d and %d \n", p,q);
}
0 Comments