I am new to programing, and I found one interesting but difficult to find reason problem, so I am writing this post.
I was trying to write swap function:
When I write swap function in traditional way,
void swap(int *x,int *y){int t=*x;*x=*y;*y=t;}
this function works and of course,
void swap(int x,int y){int t=x;x=y;x=t;}
does not work. but when I write swap as macro,
#define swap(x,y){int t=x;x=y;y=t;}
works...
why the macro can swap value though they don't use pointer?