Simple modification of C strings using pointers
I have two pointers to the same C string. If I increment the second pointer by one, and assign the value of the second pointer to that of the first, I expect the first character of the first string to be changed. For example: #include "stdio.h" int main() { char* original_str = "ABC"; // Get pointer to "ABC" char* off_by_one = original_str; // Duplicate pointer to "ABC" off_by_one++; // Increment duplicate by one: now "BC" *original_str = *off_by_one; // Set 1st char of one to 1st char of other printf("%s\n", original_str); // Prints "ABC" (why not "BBC"?) *original_str = *(off_by_one + 1); //