![]() |
In C++, the volatile keyword is used to tell the compiler that the value of the variable declared using volatile may change at any time. In this article, we will learn how to use the volatile keyword in C++. Volatile Keyword in C++We can use the volatile keyword for different purposes like declaring some global variables, variables across shared threads, etc. Syntax to use Volatile Keyword in C++volatile dataType varName; C++ Program to Show the Use of Volatile KeywordC++
Output Final value of volVar: 20
Time Complexity: O(1), for each lock and unlock operation. |
Reffered: https://www.geeksforgeeks.org
C++ |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 14 |