c flip variable

C
foo = foo^1; //XOR - flip var
Source

Also in C: