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 I find out the size of a file, prior to reading it in?

1225


How can you return multiple values from a function?

1165


Where does the name "C" come from, anyway?

1215


How can I remove the leading spaces from a string?

1211


Explain how do you determine whether to use a stream function or a low-level function?

1134


What are the application of void data type in c?

1232


When can a far pointer be used?

1078


What are the rules for the identifier?

1218


What are header files in c programming?

1180


Explain the difference between malloc() and calloc() function?

1101


What is the general form of #line preprocessor?

1039


What are operators in c?

1077


Write a program with dynamically allocation of variable.

1182


What are the loops in c?

1051


Are pointers integer?

1072