Storage Qualifiers

aka Storage Modifiers

 

by keyword:

  • const
    • Cannot be changed after its been initialised
    • e.g. const double PI = 3.141592654 ;  //assigns the defined value to an identifier named PI
  • volatile
    • Value in memory can be changed despite no direct modification by any of the program code
    • e.g. a pointer to a hardware location that contains the time, where hardware changes the value of this pointer variable and not the program
    • volatile int current_time ;  //declares a volatile variable
  • mutable
    • Member of a structure or class can be altered even if a particular structure variable, class, or class member function is constant
    • i.e. a mutable member can be modified by a const member function 

 

Leave a Reply