strcpy
#include#include #include int main () { char base_str[]="Erik was here."; // Add the + 1 for the null terminator '\0' char *cpy_str = (char *)malloc(strlen(base_str) + 1 * sizeof(char)); if(cpy_str == NULL){ fprintf(stderr, "Could not allocate memory for our strcpy.\n"); return -1; } strcpy(cpy_str,base_str); fprintf(stdout,"Base str : -%s-\n", base_str); fprintf(stdout,"Copied str : -%s-\n", cpy_str); free(cpy_str); return 0; }