Swapping two variables in place

Allan Magnuson awm at shamash.cdc.com
Sat Sep 22 14:46:50 AEST 1990


There was a message a while back about not being able to create a good
#define function to swap two variables.

How about this one: #define swap(a,b) a^=b^=a^=b



More information about the Comp.lang.c mailing list