Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Volatile variable

Where is a volatile variable stored in the program memory(in which section) ?

like image 366
Sikandar Avatar asked Nov 03 '09 05:11

Sikandar


1 Answers

volatile is a type qualifier not a storage class specifier, so it does not determine storage location at all; it affects the definition of a variable's type, not its storage.

It simply forces the compiler to explicitly read a variable whose type is volatile from the variable's storage location (wherever that may be) rather than assuming that some previously read value in a register for example remains valid.

like image 85
Clifford Avatar answered Oct 13 '22 06:10

Clifford