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 a lvalue

1035


In which header file is the null macro defined?

1301


What is 'bus error'?

1085


What are volatile variables in c?

882


Can stdout be forced to print somewhere other than the screen?

1013


What is const keyword in c?

1120


What is the difference between single charater constant and string constant?

1028


How can I call fortran?

988


How can I remove the leading spaces from a string?

1095


How is a pointer variable declared?

1022


Sir i need notes for structure,functions,pointers in c language can you help me please

2348


Explain what are multidimensional arrays?

1008


Given below are three different ways to print the character for ASCII code 88. Which is the correct way1) char c = 88; cout << c << " ";2) cout.put(88);3) cout << char(88) << " "; a) 1 b) 2 c) 3 d) constant

1083


What is structure in c language?

1090


What are multidimensional arrays?

1059