-My program is fairly straightforward, converting "Dog" to "cat" via a helper function, however I receive a Segmentation fault when I run it. I traced the error to the line " *ptr = dog ", however I don't know why that would give such an error. Help please?
If you think of ptr as the address of a pointer to the start of a string, then *ptr = dog is dereferencing an unitialised pointer. You're then overwriting the memory at that unknown location.