Hi sir, what is volatile keyword and how it's works? volatile with const qualifier i was read some read some articles but i didn't fully understand that concept.can you explain with some examples
A variable should be declared volatile whenever its value could change unexpectedly. In practice, only three types of variables could change: 1. Memory-mapped peripheral registers 2. Global variables modified by an interrupt service routine 3. Global variables accessed by multiple tasks within a multi-threaded application We'll talk about each of these cases in the sections that follow.
Volatile is a qualifier that is applied to a variable when it is declared. It tells the compiler that the value of the variable may change at any time-without any action being taken by the code the compiler finds nearby. Syntax: To declare a variable volatile, include the keyword volatile before or after the data type in the variable definition. volatile int foo; int volatile foo;