<id*************@gmail.comwrote in message
It's the first time that i've found volatile variable: what does it
mean?if pointers are not declared as volatile, what happens?
thanks in advance
"volatile" means "may be modified/read by something outside of the program",
and thus the variable is always kept in main memory, never stored in a
register exept when actually being operated upon.
This slows down the program. So only use volatile where essential. In the
nature of things, the modifying program is outside of the competence of C.
However typically you have interrupt-driven subroutines, for instance to use
the mouse. An interrupt is generated by a mouse movement, data comes in, and
is stored in volatile x,y coordinates, and control quickly returned to the
main thread. Non-interrupt routines can then use the x,y co-ordiantes to
display the mouse cursor.
--
Free games and programming goodies.
http://www.personal.leeds.ac.uk/~bgy1mm