I have a questing about pointers. When I initialize a pointer using
I can't modify it for example using strcat, I have the same problem with the following exampleCode:char * crap_ptr = "crappy pointer"
I'm guessing its because they are part of the program itself and located in the stack and malloc allocates heap memory.Code:int somefunction(char * some_ptr) { strcat(some_ptr, "hmm"); return 0; } somefunction("error"); /* will generate fatal error */
So I was hoping if someone could tell me if I'm right or not