Re: brain teasers



rohitjogya@xxxxxxxxx wrote:
a = a^b;
b = a^b;
a = a^b;

So you know the stupid XOR trick. So what? Don't perpetuate this. Just because every class of beginners has someone who thinks this is cool doesn't mean that it is worth bothering with. And you neither answered the question about what happens with non-integer variables nor demonstrated why you think the compiler doesn't generate a hidden third variable. If your trick doesn't work with non-integers (it doesn't), then the original question has not been answered. If the compiler might generate a hidden third variable, then the original question has not been answered.

.