Answer Posted / vishal
What is the significance of volatile keyword?
Volatile keyword is used to inform the compiler not to predict/assume/believe/presume the value of the particular variable which has been declared as volatile.
Why/When do we need volatile ?
In following case we need to use volatile variable.
Memory-mapped peripheral registers
Global variables modified by an interrupt service routine
Global variables within a multi-threaded application
If we do not use volatile qualifier the following problems may arise:
Code that works fine-until you turn optimization on
Code that works fine-as long as interrupts are disabled
Flaky hardware drivers
Tasks that work fine in isolation-yet crash when another task is enabled
Source: http://www.firmcodes.com/volatile-keyword-in-c-and-embedded-system/
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What does the c in ctime mean?
On most computers additional memory that is accessed through an adapter of feature card along with a device driver program. a) user memory b) conventional memory c) expandedmemory d) area
Can a variable be both constant and volatile?
Can you pass an entire structure to functions?
What is a sequential access file?
Do you know the difference between malloc() and calloc() function?
a number whose only prime factors are 2,3,5, and 7 is call humble number,,write a program to find and display the nth element in this sequence.. sample input : 2,3,4,11,12,13, and 100.. sample output : the 2nd humble number is 2,the 3rd humble number is 3,the 4th humble number is ,the 11th humble number is 12, the 12th humble number is 14, the 13th humble number is 15, the 100th humble number is 450.
What is the difference between the = symbol and == symbol?
Is main is user defined function?
What does printf does?
Explain what is the benefit of using enum to declare a constant?
explain what are pointers?
What is NULL pointer?
What is getche() function?
What are volatile variables in c?