[comp.lang.c] Swapping

bengsig@oracle.nl (Bjorn Engsig) (03/29/90)

Please folks, this is discussed ever so often here, the various "strange"
ways of doing swapping (three step add/subtract or xor) are all potentially
risky: add/subtract might overflow, xor doesn't work if you swap two
variables that are actually the same, they only work with integers (NOT,
repeat NOT with pointers), etc, etc.  Swapping is done just like you swap
two piles of paper on your desk with one hand: using temporary storage.
-- 
Bjorn Engsig,	Domain:		bengsig@oracle.nl, bengsig@oracle.com
		Path:		uunet!mcsun!orcenl!bengsig