I have written this program to make the value of a in b and the value of b in a.
For this I created temp as a temporary variable and this is my program:
#include <stdio.h>
int changevalue(int a, int b)
{
int temp;
temp = a;
a = b;
b = temp;
}
int main()
{
int a;
int b;
a = 10;
b = 20;
printf("the value of a is %d \n and b is %d",a,b);
changevalue(a,b);
printf("the value of a is %d \n and b is %d",a,b);
return 0;
}
But the values of a and b did not change .
Where is the problem?