Échanger 2 variables sans utiliser de tampon

int x = 4; int y = 7;

x += y; y = x - y; x -= y;

"Génial", non ?

Enfin bon.

Commentaires

1. Le dimanche, avril 9 2006, 12:23 par _gromit_

bof...

2. Le dimanche, avril 9 2006, 13:13 par M.Pomme

Ben.. c'est bien si on est limité en espace mémoire.

euh...

3. Le mardi, mai 2 2006, 00:08 par M.Pomme

Encore mieux :
a,b=b,a

(c'est du python, et ça marche... ;-) )