/* * strncpy.c * * Copy one string to another. * Correctly terminate the new string and do not exceed its bounds. */ #include /* Copy src into dst; return the number of characters copied */ int strncpy(char dst[], const char src[], int dst_size) { } int main() { char from[20] = ""; char to[10]; int char_copied; printf("Enter a string: "); scanf("%19s", from); char_copied = strncpy(to, from, sizeof(to)); printf("%d characters copied; the destination string is: %s\n", char_copied, to); return 0; }