I've tried to figure out what is the output of a code like this .By the way ,It is not a real question, kind of therical question, i mean it is not an original c code, it is kind of a PL having c-code syntax and passed by name parameter paradigm.
int x=12,y=10;
void tswap(int pa, int pb) {
int tmp;
tmp=pa;
pa=pb;
pb=tmp;
x=x+pa;
x=x-pb;
y++;
printf("%d %d %d %d\n",pa,pb,x,y);
}
int main() {
int a=4;
tswap(x,a);
printf("%d %d %d\n",x,y,a);
tswap(++x,++y);
printf("%d %d %d\n",x,y,a);
return 0;
}
I think the output of first part should be :
-4 12 -4 11
-4 11 12
But i could find a logical solution for the part tswap (++x, ++y) Is there anyone who can know how can I handle with this part ?
Thanks in advance !