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

What are the modifiers available in c programming language?

1279


Can we declare a function inside a function in c?

1096


What is dangling pointer in c?

1333


C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions

1107


What are structures and unions? State differencves between them.

1254


List some applications of c programming language?

999


Write a program to find factorial of a number using recursive function.

1179


Tell me what is the purpose of 'register' keyword in c language?

1039


What does & mean in scanf?

1166


Explain how do you sort filenames in a directory?

1077


An arrangement of information in memory in such a way that it can be easily accessed and processed by a programming language a) string b) data structure c) pointers d) array

1192


Explain what does the function toupper() do?

1132


What is c language in simple words?

1114


Do you know the difference between malloc() and calloc() function?

1112


WRITE A CODE IN C TO SEARCH A FILE FROM NOTEPAD FILE.

2498