- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What does the volatile keyword mean in C++?
volatile means two things −
- The value of the variable may change without any code of yours changing it. Therefore whenever the compiler reads the value of the variable, it may not assume that it is the same as the last time it was read, or that it is the same as the last value stored, but it must be read again.
- The act of storing a value to a volatile variable is a "side effect" which can be observed from the outside, so the compiler is not allowed to remove the act of storing a value; for example, if two values are stored in a row, then the compiler must actually store the value twice.
As an example −
i = 2; i = i;
The compiler must store the number two, read the variable i, store the variable that it read into i.
You can find more details on the volatile keyword here − https://www.geeksforgeeks.org/understanding-volatile-qualifier-in-c/
- Related Articles
- What does the explicit keyword mean in C++?
- What does the restrict keyword mean in C++?
- What is volatile keyword in C++?
- volatile keyword in C#
- What does the KEY keyword mean in MySQL?
- volatile Keyword in Java
- Can we make Array volatile using volatile keyword in Java?
- What does the modifier volatile in Java do?
- What does the keyword var do in C#?
- What does an auto keyword do in C++?
- What does the [Flags] Enum Attribute mean in C#?
- What does the operation c=a+++b mean in C/C++?
- What does “dereferencing” a pointer mean in C/C++?
- What does the two question marks together (??) mean in C#?
- What does int argc, char *argv[] mean in C/C++?
