The volatile keyword tells the compiler that the value of the variable may change at any time as a result of external conditions, not only as a result of program control flow.
The compiler will not optimize anything that has to do with the volatile variable.
volatile int foo; /* Different ways to ...