Multiple choice technology programming languages

Can a variable be declared as both const and volatile

  1. True

  2. False

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

A variable can be declared both const and volatile. This is useful for hardware registers that can change externally (volatile) but shouldn't be modified through the program (const). Example: volatile const int *ptr for memory-mapped I/O.