Question d’entretien chez Microchip Technology

swap a and b without using a third variable

Réponse à la question d'entretien

Utilisateur anonyme

10 avr. 2012

b = a + b a = b - a (now b's value is in a) b= b - a (b is left with a's value) example a = 6 b = 15 b= 6 + 15 = 21 a = 21 - 6 = 15(a's original value) b = 21- 15 = 6 (b's original value)

3