Is this a way to exchange variable values with undefined behavior?
#include <stdio.h> int main(void) { int x = 10, y = 20; x ^= y ^= x ^= y; printf("%d %d", x, y); return 0; }
There is a double assignment to the variable x
- is it incorrect?
PS: The question arose due to the fact that other languages otherwise calculate this construction.