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 |
difference between c and c++?
c pgm count no of lines , blanks, tabs in a para(File concept)
print the table 5 in loops
What is FIFO?
program to convert a integer to string in c language'
what is difference between array,strutter,union and pointers
3 Answers CTS, Lovely Professional University, Mannar Company,
what is the output of following question? void main() { int i=0,a[3]; a[i]=i++; printf("%d",a[i] }
Distinguish between actual and formal arguments.
when will be evaluated as true/ if(x==x==x) a) x=1; b) x=0; c) x=-1; d) none
Combinations of fibanocci prime series
What is formal argument?
What is the difference between constant pointer and constant variable?