This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| // s is a pointer to a pointer to a char which is const | |
| // (i.e. the char is const not the pointer to a pointer). | |
| // I may change the pointer (as is done here) but not | |
| // the data it ultimately points to. | |
| void constant_data(const char **s, char *t) | |
| { | |
| *s = t; // Ok. Change the pointer it points to | |
| **s = 'c' // error: read-only variable is not assignable |