Why not use: x = !x;?

Oh well, it will suffice for me that according to the code given in the reference, pinState is an integer.

So if x is an integer and x is 0, then !x is 1, right?