As i know, volatile is usually used to prevent unexpected compile optimization during some hardware operations. But which scenes volatile should be dec
volatile comes from C. Type "C language volatile" into your favourite search engine (some of the results will probably come from SO), or read a book on C programming. There are plenty of examples out there.