#include char * strncpy(char * d, const char * s, size_t n) { register char * d1 = d; while (n && *s) { n--; *d++ = *s++; } while (n--) *d++ = '\0' ; return d1; }