Here is the declaring a variable as volatile in the C program. volatile
is an ANSI C qualifier that tells the compiler, the variable value may be changed at any time by an external source (From outside the program). For Example,
volatile int date;
Here the value of the variable date can be altered by some external factors. Note that the value of the variable date can also be modified from the inside of the program.
Declaring Variable as Volatile and Constant
We can declare a volatile variable as a constant in C. In this case, the variable value cannot be changed from the inside of the program but can be modified by external factors.
volatile const date;