@kunal
Actually its not same value its the same variable and it arises only
if u code the given way(and some people do it this way)....
void swap(int &a, int &b)
{
a ^= b ^= a ^= b;
}
now we have
int a = 10;
swap(a, a)
This will set a's value to 0...and this happens while sorting arrays
when u pass the same index values...
Conclusion: Either code as given in above Q or use the temporary
var...
--
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.