volatile const int meaning in C?

c

Solution

A `volatile const` variable is one whose value may change due to external influences, and which cannot be written to.

Problem

I am reading a book on C. It mentions a concept which does not make sense to me. What I know is that the compiler sometimes optimises code by removing variables which it feels would not affect an expression. So if we specify volatile to a variable, it does not remove this variable from any expression. So the book introduces something like this: ``` volatile const int a = 1; ``` The explaination is only a couple of lines, none of which makes sense to me. Can somebody please explain why would be there a need of such a variable? PS: I understand the concept of volatile, what I dont understand is the concept of volatile const.

Original source

Related problems