I read some tutorial about volatile in the C language, but I still can not figure it out. Some say the volatile tells the complier optimizer that operations involving this variable should not be optimized in certain ways. This means anytime the value of a variable is changed in a register, then the value should affect the memory.
And also some say that volatile mean that the value can be changed by means outside this code.
I can not understand the second saying. So the volatile variable can be changed by means outside of this code? How? And are these two statements both right?