hey man u have made a very silly mistake....you have swaped only pointers
not values.....
#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("%f %f\n",*p,*q);
}gives result 20.000000 10.000000 if want to change values of x and y then do *#define swap(a,b,c) c t;*t=*a,*a=*b,*b=*t;* * * *you can check your preprocessed output in linux by using -E option* *example:gcc -E pgm.c* On Mon, Oct 10, 2011 at 10:19 PM, sravanreddy001 <[email protected]>wrote: > The swap is happenning between the p & q pointers, > > https://ideone.com/4MdX4 > > p points to y, q points to x after swap. > > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/algogeeks/-/XvbyN8ajVEUJ. > > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- Thanks & Regards Prasad Y.Jondhale M.Tech(software engg.), Delhi College Of Engineering, Main Bawana road,Delhi-110042 Ph-09540208001 -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
