Can a C++ variable be both const and volatile?

C++Server Side ProgrammingProgramming

Yes a C++ variable be both const and volatile. It is used in situations like a read-only hardware register, or an output of another thread. Volatile means it may be changed by something external to the current thread and Const means that you do not write to it (in that program that is using the const declaration).

raja
Published on 15-Feb-2018 07:03:10
Advertisements