I am trying to change chars pointed to by a char pointer variable:
char *test3 = "mutable"; printf("Expected: mutable, Result: %s\n", test3); testt(test3); printf("Expected tutable, Result: %s\n", test3); void testt(char *s) { *s = 't'; // FAILS, I get Segmentation Fault Error }
Why does the above approach not work? Are chars pointed to by pointer variables immutable? If so, how would I modify the contents of the pointer variable?