Our own string copy function based on pointer
#include <stdio.h>
void mycpy(char *to, char *from);
int main(void)
{
char str[80];
mycpy(str, "this is a test");
printf(str);
return 0;
}
void mycpy(char *to, char *from)
{
while(*from)
*to++ = *from++;
*to = '\0'; /* null terminates the string */
}
Related examples in the same category