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 is a pointer in c plus plus?
What does the function toupper() do?
What is the right type to use for boolean values in c?
What is abstract data structure in c?
How can you tell whether two strings are the same?
What are the types of c language?
what is recursion in C
what is the basis for selection of arrays or pointers as data structure in a program
What is a struct c#?
Why do we use return in c?
difference between Low, Middle, High Level languages in c ?
How can I swap two values without using a temporary?
Why is #define used?
List the difference between a While & Do While loops?
Explain About fork()?