I'm doing an exercise for my college and I am somewhat lost on pointers.
The whole exercise is telling us to make a function char *mystrcpy(char *dest, char *src). So what we need is to make an already included in <string.h> by ourselves.
char *mystrcpy(char *dest, char *src)
It's not that hard as for the logical steps of the function, but i don't get why we need to use the function char *mystrcpy() as a pointer. Also how do we use functions as pointers and why?
char *mystrcpy()
You don't need a pointer to function but a function that return a pointer. like :
char* strcpy(char* destination, const char* source);
that return a pointer to destination.
2.1m questions
2.1m answers
60 comments
57.0k users