top button
Flag Notify
Site Registration

What is the meaning of volatile variable in C/C++?

+3 votes
What is the meaning of volatile variable in C/C++?
posted Jan 21, 2015 by Alwaz

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+2 votes

Volatile variable:

Variables prefixed with the keyword volatile acts as a data type qualifier. The volatile keyword attempts to alter the default way in which the variables are stored and the way the compiler handles the variables.
It is a kind of instruction to the optimizer to not to optimize the variables during compilation.

answer Jan 22, 2015 by Mohammed Hussain
Similar Questions
+1 vote

In large product based companies LLD is written by senior team members and developers write the code.
Does the senior team member decide what data type they should use in advance ? If yes then what things derives type of data for example. How they decide a variable should be declared as volatile ? and what would be advantage of having a variable volatile and what could be the problem if it is taken without the volatile ?