8.5.1 Structure and Union Qualifiers
The MPLAB XC32 C/C++ Compiler supports the use of type qualifiers on
structures. When a qualifier is applied to a structure, all of its members will inherit
this qualification. In the following example the structure is qualified
const.
const struct {
int number;
int *ptr;
} record = { 0x55, &i };
In this case, the entire structure will be placed into the program memory
and each member will be read-only. Remember that all members are usually initialized if a
structure is const as they cannot be initialized at runtime.
If the members of the structure were individually qualified
const, but the structure was not, then the structure would be
positioned into RAM, but each member would be read-only. Compare the following structure
with the above.
struct {
const int number;
int * const ptr;
} record = { 0x55, &i};
