how the compiler treats any volatile variable?Explain with
example.
Answer Posted / 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 |
Post New Answer View All Answers
How does free() know explain how much memory to release?
Why does the call char scanf work?
what is event driven software and what is procedural driven software?
What is a nested formula?
Create a simple code fragment that will swap the values of two variables num1 and num2.
Once I have used freopen, how can I get the original stdout (or stdin) back?
What is .obj file in c?
What is difference between scanf and gets?
What is the advantage of using #define to declare a constant?
Explain what is the stack?
Write a program to print fibonacci series using recursion?
What is difference between far and near pointers?
What is c programing language?
write a program to rearrange the array such way that all even elements should come first and next come odd
What is meant by type casting?