What do you mean by volatile and mutable keywords used in c++?



What do you mean by volatile and mutable keywords used in c++?..

Answer / Mudit Kumar

In C++, the `volatile` keyword is used to inform the compiler that a variable's value might be modified by means outside of the program, such as hardware or another thread. On the other hand, the term 'mutable' is not a keyword in C++ but rather a concept used within C++11's std::mutex, where it indicates that the variable can be modified while the mutex is locked, allowing for more efficient synchronization.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ General Interview Questions

write program for palindrome

81 Answers   Amazon, Aricent, CSC, GE, HCL, Infosys, Syntel, Temenos, Wipro,


What is the difference between the parameter to a template and the parameter to a function?

1 Answers  


Explain the difference between struct and class in terms of access modifier.

1 Answers  


template<class T, class X> class Obj { T my_t; X my_x; public: Obj(T t, X x) : my_t(t), my_x(x) { } }; Referring to the sample code above, which one of the following is a valid conversion operator for the type T? a) T operator T () { return my_t; } b) T operator(T) const { return my_t; } c) operator(T) { return my_t; } d) T operator T (const Obj &obj) { return obj.my_t; } e) operator T () const { return my_t; }

1 Answers   Quark,


what is the use of Namespace in c++.

3 Answers  


What is the sequence of destruction of local objects?

1 Answers  


What is dev c++ used for?

1 Answers  


When a function is made inline. Write the situation where inline functions may not work.

2 Answers  


What is the purpose of decltype?

1 Answers  


What is do..while loops structure?

1 Answers  


What is setfill c++?

1 Answers  


What are function poinetrs? where are they used?

1 Answers   CTS,


Categories