pass by value in c

when the values of arguments are passed to the called function from calling function,here duplicate is made and copied into the called function. The original value of the calling function will not affect if we change the value of the called function. Let’s see one example

int add(int p,int q);
int main()
int a,b,c;
printf("Enter two numbers \n");
printf("\n Sum of %d and %d is %d ",a,b,c);
int add (int p, int q)
int result;
result = p+q;


Enter two numbers
10 56
Sum of 10 and 56 is 66

so,here num1 and num2 are original values,the duplicate values will be sent to the calling function ,these are copied to number1 and number2, here the interchange occurs .but if we look close to the program the output printf statements are inside main and these will print the original values