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 |
Write a C program to print 1 2 3 ... 100 without using loops?
what is the difference between while and do while?
write a C code to reverse a string using a recursive function, without swapping or using an extra memory.
9 Answers Motorola, TCS, Wipro,
what is difference between array,strutter,union and pointers
3 Answers CTS, Lovely Professional University, Mannar Company,
List some of the static data structures in C?
What are the two forms of #include directive?
If the static variable is declared as global, will it be same as extern?
please give me some tips for the selection in TCS.
Write a program to print numbers from 1 to 100 without using loop in c?
How to explain the final year project as a fresher please answer with sample project
What are the advantage of c language?
wite a programme in c to linear search a data using flag and without using flags?