When volatile can be used?

Answer Posted / qqlin

it means this value will be changed unexpectedly. everytime
the program wants to use it, it can only be got from memory
but not from the register directly.

if you want a variable can be accessed by several threads,
you need this key word, like in ISR program, etc.

Is This Answer Correct ?    5 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a storage class? Mention the storage classes in c++.

583


What is encapsulation in C++? Give an example.

576


Why do we use constructor?

581


Can we use struct in c++?

576


how to explain our contribution in the project?

3059






What is iterator in c++?

597


What is capacity in vector in c++?

531


What is istream and ostream in c++?

576


What is difference between class and function?

574


What are static variables?

606


Can a Structure contain a Pointer to itself?

600


How do you invoke a base member function from a derived class in which you’ve overridden that function?

569


Can I learn c++ as my first language?

593


Will rust take over c++?

577


What are member functions used in c++?

535