
Patrick B. answered 06/04/19
Math and computer tutor/teacher
Volatile keyword tells the compiler to turn off optimizations and leave the code as written because the variable can change its value at any time from some EXTERNAL source code, component, library, or driver and NOT by the current local code in memory. Also, the variable will have to be checked and read each time it is accessed .
The uses include , but not limited to, interfacing with device driver code interface, peripheral devices, multi-threading, and other types of inter-process and intra-process communications.