#include #include #include /* Copy s to a fresh allocated string and return it */ char *string_copy(const char *s){ static char *new_str; new_str = (char *)malloc(strlen(s)+1); strcpy(new_str,s); return new_str; } int main(void) { char s[] = "Aalborg University", *t; t = string_copy(s); strcpy(s,"---"); /* destroy s */ printf("The original is: %s.\nThe copy is: %s\n", s, t); return 0; }