The classic function char *strcpy(char *destination, const char *source);
strcpy(3) needs a destination buffer where the source string is copied. We ask you to code a function which allocates a buffer itself, and then performs the copy.
The use of copy functions as memcpy
or strcpy
is not allowed.
Hint : use malloc(3). Don't forget that malloc can fail sometimes...