I have created a pointer variable to point to an active variable. I have two variables, I want to toggle the active variable between these two variables. Managed to do this inside the main. Now I want to extend this to another function
int main()
{
int x = 0;
int y = 0;
int *active=&y;
if(active == &x)
active = &y;
else
active = &x;
}
I dont want to swap the values of the variables, x, y.
x, y are coordinates of a cartesian plane.