volatile uint16_t x; uint8_t volatile * p_reg; uint16_t volatile * volatile p_y; 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