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 are the advantages of pointers?

790


What are the two types of polymorphism?

764


Can there be at least some solution to determine the number of arguments passed to a variable argument list function?

768


What things would you remember while making an interface?

749


How long does it take to get good at leetcode?

867






How do you instruct your compiler to print the contents of the intermediate file showing the effects of the preprocessor?

804


Write a single instruction that will store an EVEN random integer between 54 and 212 inclusive in the variable myran. (NOTE only generate EVEN random numbers)

1686


Which software is best for c++ programming?

756


Why c++ is created?

740


What is wrapper class in c++?

790


Name four predefined macros.

786


What is the auto keyword good for in c++?

831


How many static variables are created if you put one static member into a template class definition?

736


Does c++ have foreach?

719


What is extern c++?

702