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 / vishal

What is the significance of volatile keyword?
Volatile keyword is used to inform the compiler not to predict/assume/believe/presume the value of the particular variable which has been declared as volatile.



Why/When do we need volatile ?
In following case we need to use volatile variable.




Memory-mapped peripheral registers
Global variables modified by an interrupt service routine
Global variables within a multi-threaded application
If we do not use volatile qualifier the following problems may arise:




Code that works fine-until you turn optimization on
Code that works fine-as long as interrupts are disabled
Flaky hardware drivers
Tasks that work fine in isolation-yet crash when another task is enabled

Source: http://www.firmcodes.com/volatile-keyword-in-c-and-embedded-system/

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the properties of union.

1080


What is difference between structure and union in c programming?

1100


Why pointers are used in c?

1006


What are nested functions in c?

1015


Synonymous with pointer array a) character array b) ragged array c) multiple array d) none

1061


What is a sequential access file?

1172


What is d scanf?

1084


Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......

2187


Describe how arrays can be passed to a user defined function

1291


What is union and structure in c?

1218


Is c still relevant?

1079


What is oops c?

1237


Can we use visual studio for c?

1084


How would you obtain the current time and difference between two times?

1287


c programs are converted into machine language with the help of a) an interpreter b) a compiler c) an operatinf system d) none of the above

1256