I have a question about this procedure. Could this exchange of variables be simplified without using an auxiliary variable?
Practicing with pointers I came up with this dilemma and I do not know another solution to this problem. The idea is that each instruction is executed in a linear way so there is no case that it can replace "aux" because either first change the value from n1 to n2 or from n2 to n1. My idea is to learn new techniques.
int main()
{
int n1=2;
int n2=5;
int aux=0;
int *p1 = &n1;
int *p2 = &n2;
aux = n1;
*p1 = n2;
*p2 = aux;
printf("%d %d",n1,n2);
return 0;
}