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 |
What is p in text message?
What is a newline escape sequence?
Write a program in C to convert date displayed in gregorian to julian date
main() { int i = 10; printf(" %d %d %d ", ++i, i++, ++i); }
Write a code to reverse string seperated by spaces i/p str=India is my country o/p str=aidnI si ym yrtnuoc After writing code, optimize the code
What does typeof return in c?
code for bubble sort?
program to get the remainder and quotant of given two numbers with out using % and / operators?
10 Answers College School Exams Tests, IBM,
write a program for odd numbers?
program in c to print 1 to 100 without using loop
What is function in c with example?
When the macros gets expanded?