Re: [algogeeks] preprocessor query

2011-06-29 Thread sachin sharma
@Anika Jain #include#define FUN(a,b,c)c t; t=a;a=b;b=t; int main(){ int a=2,b=3; int *x,*y; x=&a,y=&b; printf("%d %d \n",a,b); printf("%u %u \n",x,y); FUN(x,y,int *); printf("%d %d \n",a,b); printf("%u %u \n",x,y); return 0;} Output: 1234 2 3 32128519

Re: [algogeeks] preprocessor query

2011-06-29 Thread Naveen Kumar
You're printing a & b. Value of a and b are not changed. On Wed, Jun 29, 2011 at 3:51 PM, Naveen Kumar wrote: > Its swapping correctly > Now x is pointing to &b and y is pointing to &a. > > On Wed, Jun 29, 2011 at 3:45 PM, Anika Jain wrote: >> >> #define FUN(a,b,c)    c t; t=a;a=b;b=t; >> >> >>

Re: [algogeeks] preprocessor query

2011-06-29 Thread Naveen Kumar
Its swapping correctly Now x is pointing to &b and y is pointing to &a. On Wed, Jun 29, 2011 at 3:45 PM, Anika Jain wrote: > > #define FUN(a,b,c)    c t; t=a;a=b;b=t; > > > int main() > { >     int a=2,b=3; >     int *x,*y; >     x=&a,y=&b; >     FUN(x,y,int *); >     printf("%d %d \n",a,b); >   

[algogeeks] preprocessor query

2011-06-29 Thread Anika Jain
#define FUN(a,b,c)c t; t=a;a=b;b=t; int main() { int a=2,b=3; int *x,*y; x=&a,y=&b; FUN(x,y,int *); printf("%d %d \n",a,b); return 0; } why doesnt this macro swap pointers wen it can work for variables?? -- You received this message because you are subscribed to th