Check out example codes for "c toggle variable". It will help you in understanding the concepts better.

Code Example 1

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

Learn ReactJs, React Native from akashmittal.com