@prasad jondhale: +1

Thanx.

Wasif Hossain
Final Semester Student,
Computer Science and Engineering(CSE),
Bangladesh University of Engineering and Technology(BUET)
Dhaka, Bangladesh.

On Wed, Oct 12, 2011 at 3:47 AM, prasad jondhale
<jondhale.pra...@gmail.com>wrote:

> 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 <sravanreddy...@gmail.com
> > 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 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.
>>
>
>
>
> --
>
> 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 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.

Reply via email to