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
What math functions are available for integers? For floating point?
Explain two-dimensional array.
What is the method to save data in stack data structure type?
Can one function call another?
Declare the structure which contains the following members and write in C list of all students who score more than 75 marks. Roll No, Name, Father Name, Age, City, Marks.
How many data structures are there in c?
Where we use clrscr in c?
What does *p++ do?
Place the #include statement must be written in the program?
How can I remove the leading spaces from a string?
What is the default value of local and global variables in c?
What does %d do in c?
What is the benefit of using #define to declare a constant?
What is a pragma?
a function gets called when the function name is followed by a a) semicolon (;) b) period(.) c) ! d) none of the above