macros i thnik cant swap pointers..i have doubt for same it is test ur c skil question
On Sun, Oct 9, 2011 at 10:08 PM, sunny agrawal <sunny816.i...@gmail.com>wrote: > because you have not made any call to swap values of x and y > > I Don't know what you are trying to do here > if you want to swap values why are you not calling macro swap(x,y,int) > you are making a macro call to swap pointers and you can check that pointer > will get swapped. > > > On Sun, Oct 9, 2011 at 9:20 PM, Rajesh Kumar <testalgori...@gmail.com>wrote: > >> >> >> ---------- Forwarded message ---------- >> From: Rajesh Kumar <testalgori...@gmail.com> >> Date: Sun, Oct 9, 2011 at 2:58 PM >> Subject: why we can not swap values using macro? >> To: algogeeks@googlegroups.com >> >> >> why this code doesn't swap values of x and y? >> >> #include<stdio.h> >> #define swap(a,b,c) c t;t=a,a=b,b=t; >> main() >> { >> float x=10,y=20; >> float *p,*q; >> p=&x,q=&y; >> swap(p,q,float *); >> printf("%d %d\n",x,y); >> } >> >> >> -- >> Regards >> Rajesh Kumar >> >> >> >> >> >> -- >> Regards >> Rajesh Kumar >> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Algorithm Geeks" group. >> To post to this group, send email to algogeeks@googlegroups.com. >> To unsubscribe from this group, send email to >> algogeeks+unsubscr...@googlegroups.com. >> For more options, visit this group at >> http://groups.google.com/group/algogeeks?hl=en. >> > > > > -- > Sunny Aggrawal > B.Tech. V year,CSI > Indian Institute Of Technology,Roorkee > > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.