Easy Pointer question
how do i copy ptr_string and put it into string?
what about the other way?
string = strdup(ptr_string);
ptr_string = strdup(string); ? or is it
ptr_string= (char *)malloc (strlen(string) * sizeof(char));
The way strdup() is described, you'd do something like:
but by the way you worded the question you want it assigned the other way around? There is no storage allocated for ptr_string yet. Only the array string has storage so far. Your guesses seem to be more like what I have. strdup does an implicit malloc for you.
ptr_string = strdup(string)