Why is volatile needed in C? What is it used for? What will it do?
volatile
In simple terms, it tells the compiler not to do any optimisation on a particular variable. Variables which are mapped to device register are modified indirectly by the device. In this case, volatile must be used.