Question 11
Back to Exercise
What does volatile int status; tell the compiler?
- A status cannot change
- B status may change outside the program's control, so every access must actually read or write memory Correct
- C status is stored in a register
- D status is shared safely between threads
Correct Answer: Option B
volatile stops the compiler from caching the value or removing "redundant" accesses – needed for hardware registers and signal-handler flags. It does not make access atomic or thread-safe.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!