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

What is bss in c?

1054


What is struct node in c?

1037


Why does everyone say not to use scanf? What should I use instead?

1384


hi send me sample aptitude papers of cts?

2116


What is the explanation for prototype function in c?

937


When can you use a pointer with a function?

1012


Is c easier than java?

1007


What is calloc in c?

1091


What is assert and when would I use it?

974


What is #line in c?

972


Explain the difference between getch() and getche() in c?

949


what is the role you expect in software industry?

2101


Is there a built-in function in C that can be used for sorting data?

1197


How can this be legal c?

1056


`write a program to display the recomended action depends on a color of trafic light using nested if statments

2088