how do i change the fuction below using pointer method to return back the value of x and y?
Code:void exchange(int x,int y)
{
int temp;
temp = x;
x = y;
y = temp;
return ;
}
Printable View
how do i change the fuction below using pointer method to return back the value of x and y?
Code:void exchange(int x,int y)
{
int temp;
temp = x;
x = y;
y = temp;
return ;
}
You would change the parameters x and y such that they are pointers to int rather than int variables. Then you make the corresponding changes to the implementation of the function.
Here's a hint: When someone asks how to do something, don't do the whole thing for them. Tell them how, they can try it, and if they have problems, they can post their code and people can explain the process again.
Quzah.