K & R C Programs Exercise 5-5.

K and R C, Solution to Exercise 5-5:
K and R C Programs Exercises provides the solution to all the exercises in the C Programming Language (2nd Edition). You can learn and solve K&R C Programs Exercise.
C Program to write the versions of the library functions strncpy, strncat, and strncmp, which operate on at most the first n characters of their argument strings.
For example, strncpy(s, t, n) copies at most n characters of t to s. Read more about C Programming Language .
/***********************************************************
* You can use all the programs on www.c-program-example.com
* for personal and learning purposes. For permissions to use the
* programs for commercial purposes,
* contact info@c-program-example.com
* To find more C programs, do visit www.c-program-example.com
* and browse!
*
* Happy Coding
***********************************************************/

/*strncpy: copy n characters from t to s*/
void strncpy(char *s, char *t, int n)
{
while(*t && n--> 0)
*s++ = *t++;
while( n--> 0)
*s++ = '