Modifying a char *const string
I know that const char * is a pointer to a const char, while char *const is a constant pointer to a char. I am testing this in the following code: const char *s = "hello"; // Not permitted to modify the string "hello" char *const t = "world"; // Not permitted to modify the pointer t s = "hello2"; // Valid // t = "world2"; // Invalid, gives compilation error // *(s + 1) = 'a'; // Invalid, gives compilation error *(t + 1) = 'a'; // Why does this not work? The last line does not give any error, but causes the program to terminate unexpectedly. Why is modifying the string pointed to by t not