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 is the purpose of void pointer?
Do you have any idea about the use of "auto" keyword?
What does double pointer mean in c?
Which is best linux os?
Write a C Program That Will Count The Number Of Even And Odd Integers In A Set using while loop
Not all reserved words are written in lowercase. TRUE or FALSE?
What is variable declaration and definition in c?
What is the use of linkage in c language?
What's the total generic pointer type?
What are the different categories of functions in c?
Can you write the function prototype, definition and mention the other requirements.
Explain high-order bytes.
What is a stream water?
What are the 4 types of unions?
What are linked lists in c?