What follows is a very simple test to improve my understanding of C pointers. I have two pointers. The first pointer is assigned the value "Hello". Then the second pointer is set to the first pointer. Correct me if I am wrong, but now both pointers should point to the same string? Anyways, I change the contents of firstString to be "Goodbye". When I print out what both pointers are pointing to, I get "Hello" and "Goodbye". I don't understand how this is possible.
int main(int argc, char **argv)
firstString = "Hello";
newString = firstString;
firstString = "Goodbye";
printf("The memory location pointed to by firstString is: %d\n", firstString);
printf("The memory location pointed to by newString is: %d\n", newString);