What is the use of volatile keyword in c++? Give an example.

Answer Posted / hrpynux@gmail.com

The volatile keyword is intended to prevent the compiler from applying any optimizations on objects that can change in ways that cannot be determined by the compiler. Objects declared as volatile are omitted from optimization because their values can be changed by code outside the scope of current code at any time.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is virtual destructor ans explain its use?

620


How do you remove an element from a set in c++?

595


What is :: operator in c++?

591


what is the use of void main() in C++ language?

654


Write a program for Divide a number with 2 and Print the output ( NOTE: Check for divide by zero error).

642






How can an improvement in the quality of software be done by try/catch/throw?

601


What is called array?

630


Which software is best for coding?

591


In the derived class, which data member of the base class are visible?

656


What does ctime() do?

623


What is vectorial capacity?

660


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

597


Why do we need constructors in c++?

638


Is atoi safe?

614


How do you find out if a linked-list has an end? (I.e. The list is not a cycle)

618