how the compiler treats any volatile variable?Explain with
example.
Answer / daniboy
A volatile variable is one whose VALUE CAN CHANGE
UNEXPECTEDLY. Consequently, the compiler can make NO
ASSUMPTIONS about the value of the variable. In
particular, the optimizer must be careful to RELOAD the
variable every time it is used instead of holding a copy in
a register.
Examples of volatile variables are:
(a) Hardware registers in peripherals (e.g., status
registers)
(b) Non-stack variables referenced within an interrupt
service routine.
(c) Variables shared by multiple tasks in a multi-
threaded application.
Source: 10 Best Questions to would-be Embedded Programmers -
By Nigel Johns
| Is This Answer Correct ? | 6 Yes | 0 No |
What is meant by errors and debugging?
What is the newline escape sequence?
What is an example of structure?
how to print electricity bill according to following charges first 100 units -1rs per unit for next 200 units-1.50 rs per unit without using conditions
Can we declare function inside main?
Is c easier than java?
Explain the Difference between the New and Malloc keyword.
What is #include conio h?
What is difference between structure and union with example?
can we change the default calling convention in c if yes than how.........?
What is string length in c?
What is the difference between malloc calloc and realloc in c?