Quick Review: strdup()
char *strdup(char *original_string)
// Allocate memory for the new string using malloc(). The size of the new
// memory is the size of the original string, plus 1 for the NULL at the end.
new_string = (char *) malloc((strlen(original_string) + 1) * sizeof(char));
// Copy the old string into the space just allocated for the new string.
strcpy(new_string, original_string);
// Return a pointer to the memory that we just allocated.
strcpy(string1, “John Doe”); // OK
strcpy(string2, string1); // ERROR -- string2 is a wild pointer
string2 = strdup(string1); // OK
free(string1); // ERROR -- don’t free an array
free(string2); // REQUIRED -- in order to free the mem allocated by strdup