when swap is called ,as it is a macro ,before compilation its code is
replaced and the code before compilation bcomes:

> # define swap(a,b) temp=a; a=b; b=temp;
> main( )
> {
> int i, j, temp;
> i=5;
> j=10;
> temp=0;
> if( i > j)
>
   //code replaced here

> temp=a;   //not executed (false)
>
   a=b;         //a=10(from b=10)
   b=temp;   //b=0 (from temp=0)

> printf( ā€œ%d %d %dā€, i, j, temp);
> }
>
> and that is why u get output  10,0,0...
>
>

-- 
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