A Little about the blog.....

This blog contains all the interview questions that i face during my interviews with various MNC's. I am trying to post the solutions for almost all the questions and i have covered few important topics which would be frequent topics in interviews. I hope the blog would be useful not only for the job aspirants but also to the one who tries to upgrade his/her knowledge in C and Embedded concepts......

please enter your mail address in the above mail address box to get the immediate updates of the new interview questions.....

Wednesday, November 16, 2011

what do u mean by a volatile in C langauge.

The keyword "VOLATILE" is used to define a variable so as to inform the compiler that the variable value can change at any instant of time and is not a constant through out the program.

Interview Question: How the compiler treats any volatile variable?
Explanation: 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.

1 comment:

  1. Thanks for sharing your info. I really appreciate
    your efforts and I will be waiting for your further write ups thanks once again.
    html5 video player| html5 player

    ReplyDelete