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
How can I read and write comma-delimited text?
What is difference between structure and union in c programming?
Why isnt there a numbered, multi-level break statement to break out
In C programming, how do you insert quote characters (‘ and “) into the output screen?
What are c header files?
why do some people write if(0 == x) instead of if(x == 0)?
how can i access hard disk address(physical address)? are we access hard disk by using far,near or huge pointer? if yes then please explain.....
Why we use void main in c?
How are portions of a program disabled in demo versions?
What type of function is main ()?
How variables are declared in c?
When can you use a pointer with a function?
How do you write a program which produces its own source code as output?
What would the following code segment printint k = 8;docout << "k = " << k << " ";while k++ < 5; a) 13 b) 5 c) 8 d) pointers
What are the different types of pointers used in c language?