<=> and obfuscation

Arnold Robbins arnold at gatech.UUCP
Fri Feb 8 04:49:22 AEST 1985


> [Aren't you hungry...]
> 
> 	To exchange two items without an intermediate variable, try:
> 
> 	b ^= a ^= b ^= a
> 
> Jon Shapiro

However, if a == b when you start out, you end up with a == 0 && b == 0.

This also only works on integer style variables.
-- 
Arnold Robbins
CSNET:	arnold at gatech	ARPA:	arnold%gatech.csnet at csnet-relay.arpa
UUCP:	{ akgua, allegra, hplabs, ihnp4, seismo, ut-sally }!gatech!arnold

Help advance the state of Computer Science: Nuke a PR1ME today!



More information about the Comp.lang.c mailing list