What is volatile variable?
Volatile means the storage is likely to change at anytime and be changed but something outside the control of the user program. This means that if you reference the variable, the program should always check the physical address (ie a mapped input fifo), and not use it in a cashed way. Variables declared to be volatile will not be optimized by the compiler because the compiler must assume that their values can change at any time. We use volatile keyword to declare the volatile variable.