Is there any built in swap function in C which works without using a third variable?
#define swap(T, x, y) \ { \ T tmp = x; \ x = y; \ y = tmp; \ } int main() { int a = 10; int b = 20; printf("a=%d b=%d\n", a, b); swap(int, a, b); printf("a=%d b=%d\n", a, b); return 0; }