Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is an volatile variable?

Answer Posted / chandrashekar kalvacherla

volatile tells the compiler that this variable can get altered by ways that the compiler cannot deduce. As a consequence, the compiler will exclude that variable from optimizations and the code will always fetch the variables content from memory, even if it has done so before (no caching).

Imagine a hardware clock which is mapped into memory. You need some way to tell the compiler: whenever I access that variable (mapped to the hardware clock), I want you to actually fetch the content from there. Otherwise the compiler might just ask the clock once for the current time and use the cached value (in a processor register) throught the rest of the program.

Is This Answer Correct ?    8 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How can you find out how much memory is available?

1072


What is multidimensional arrays

1130


What is pragma in c?

1219


What does void main () mean?

1241


What is file in c language?

1010


How can I send mail from within a c program?

1034


Explain what are the different file extensions involved when programming in c?

1113


What is an array in c?

1053


How do I get a null pointer in my programs?

1115


Explain what could possibly be the problem if a valid function name such as tolower() is being reported by the c compiler as undefined?

1022


What is the general form of #line preprocessor?

1001


What is build process in c?

1160


How can you invoke another program from within a C program?

1075


Why doesnt the call scanf work?

1195


How can I invoke another program or command and trap its output?

1098