Volatile

In this lesson, we'll understand how volatile variables behave.

Definition #

The volatile variable is one whose value may change due to an external event.

Usually, we can only change the value of a variable within our code. Let’s say there is an external I/O event that tries to change the value of the variable. This would not be allowed.

However, it would be possible if the variable was volatile. A volatile variable can be declared using the ...