Start New Discussion within our Software Development Community

How might I write an implementation in C of the standard library function strcpy ? Here's how I might.

#include <stdio.h>

char *mystrcpy(char *dst, const char *src)
{
   char *start = dst;
   do {
      *dst++ = *src;
   } while ( *src++ );
   return start;
}

int main (void)
{
   char text[12];
   puts(mystrcpy(text, "Hello world"));
   return 0;
}

/* my output
Hello world
*/
The article starter has earned a lot of community kudos, and such articles offer a bounty for quality replies.