In C, the volatile keyword is used to indicate that a variable may be changed unexpectedly by the program, such as by hardware or by other parts of the program that the compiler may not be aware of. This prevents the compiler from applying certain optimizations that might not be safe when dealing with such variables. Here's an example to illustrate the use of volatile:
Program.c
In this example, sensor_value is marked as volatile because its value might change due to hardware (like a sensor updating its value), and the compiler should not make assumptions about its value being constant.
With supporting text below as a natural lead-in to additional content.