It appears that there is no explanation about type qualifiers. I did some surfing and found out that there are 3 type qualifiers, that are : const, volatile, and restrict. May someone explain about these and when to use them?
const: value cannot be changed (without some hacks). Compiler is able to generate more efficient code on this assumption (for example replace compile-tyme constants with it's values). Also you are less likely to accidently change what doen't meant to change (protect you from errors)
volatile: this variable can be changed by OS, another thread or memory-mapped device, so compiler cannot optimize away any operatopns with it: ++x; --x; would be probably optimized away (as state of x is the same before and after those operations) but if x is volatile it cannot do that (as x can be read between them).
restrict: not part of C++. In C99 it promises that only restricted pointer will access object it points to. Allows more optimizations