8.6.4. Constant Pointer to Constant Data
The minimum access privilege is granted by a constant pointer to constant data. Such a pointer always points to the same memory location, and the data at that location cannot be modified via the pointer. This is how a built-in array should be passed to a function that only reads from the built-in array, using array subscript notation, and does not modify the built-in array. The program of Fig. 8.12 declares pointer variable
ptr to be of type
const int * const (line 13). This declaration is read from right to left as “
ptr is a constant pointer to an integer constant.” The figure shows the Xcode LLVM compiler’s error messages that are generated when an attempt is made to modify the data to which
ptr points ...