Can a variable be both const and volatile? Ans. Yes. The const modifier means that this code cannot change the value of the variable, but that does not mean that the value cannot be changed by means outside this code. For instance, the timer structure was accessed through a volatile const pointer. The function itself did not change the value of the timer, so it was declared const. However, the value was changed by hardware on the computer, so it was declared volatile. If a variable is both const and volatile, the two modifiers can appear in either order. - Study24x7
Social learning Network
17 Mar 2023 11:16 AM study24x7 study24x7

Can a variable be both const and volatile? Ans. Yes. The const modifier means that this code cannot change the value of the variable, but that does not mean that the value cannot be changed by means outside this code. For instance, the timer structure was accessed through a vola...

See more

study24x7
Write a comment
Related Questions
500+   more Questions to answer
Most Related Articles