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