So...digitalread return a bool, and ...what exactly does the second line do?
if curState is not 0 ... then ..(questionmark?) ..toggles it between 0 and 1 ? ...or something like that?
I have this understanding: digitalRead() returns a value whose data type is int. If the returned value is within 3.0V - 5.0V, then the value is defined as HIGH; if the returned value is within 0.0V - 0.9V, then the value is defined as LOW.
Only on a limited range of the Arduino "family" - not, for instance, on a Due, any of the 3.3V AVRs or the ESP lines of processors.
You may supply 5V to them, but that's not the logic level.
It's just a more explicit way to execute a boolean if you want to run a function or anything else than just getting/setting a value.
You could say:
uint8_t lastState = (curState != 0) ? 0 : FunctionStateOn();
Anything after the ? is either true : false; you could also return null. In your case, it just return the number. Probably an habit from the programmer to always use it like this.
The voltage you supply to the board may not be the processor's Vcc, so your post is pretty much just so much obfuscating noise, with almost zero information.
Don't forget, between the USB +5V and the processor's Vcc pin, there may be a regulator.
The reference Board is Arduino UNO; where, the 5V coming from PC over the USB Port is directly connected (via MOSFET switch) to the Vcc (digital) pin of ATmega328P MCU of the UNO Board. (Please, see the schematic here.)