Datasheet
TYPE QUALIFIERS
The type qualifiers const and volatile are optional in declarations and do not
actually affect the type of declared object.
Qualifier const
The qualifier const implies that a declared object will not change its value during
runtime. In declarations with the
const qualifier all objects need to be initialized.
The mikroC PRO for AVR treats objects declared with the
const qualifier the same
as literals or preprocessor constants. If the user tries to change an object declared
with the const qualifier compiler will report an error.
For example:
const double PI = 3.14159;
Qualifier volatile
The qualifier volatile implies that a variable may change its value during runtime
independently from the program. Use the volatile modifier to indicate that a variable
can be changed by a background routine, an interrupt routine, or I/O port. Declaring
an object to be volatile warns the compiler not to make assumptions concerning the
value of an object while evaluating expressions in which it occurs because the value
could be changed at any moment.
183
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Language Reference
mikroC PRO for AVR
CHAPTER 5