how the compiler treats any volatile variable?Explain with
example.



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

Post New Answer

More C Interview Questions

wap in c to accept n number display the highest and lowest value

2 Answers  


What is structure padding & expalain wid example what is bit wise structure?

1 Answers  


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.

0 Answers  


Write a simple program to find the size of different basic data types in C.

3 Answers  


What is default value of global variable in c?

0 Answers  






C passes By value or By reference?

5 Answers   Geometric Software, Infosys,


What is the condition that is applied with ?: Operator?

0 Answers  


Explain is it valid to address one element beyond the end of an array?

0 Answers  


What is the purpose of main() function?

0 Answers  


Can you mix old-style and new-style function syntax?

0 Answers  


Program to display given 3 integers in ascending order

1 Answers   N Tech,


write a program in c language that uses function to locate and return the smallest and largest integers in an array,number and their position in the array. it should also find and return the range of the numbers , that is , the difference between the largest number and the smallest.

1 Answers  


Categories