#include <stdio.h>

void strcat1(char s[], char t[]);

/* test strcat1 */
int
main()
{
    char s[20] = {'H', 'e', 'l', 'l', 'o', '\0'};
    char t[] = " world\n";

    strcat1(s, t);
    printf("%s", s);

    return 0;
}

/* strcat1: concatenate t to end of s; s must be big enough */
void
strcat1(char s[], char t[])
{
    int i, j;

    i = j = 0;
    while (s[i] != '\0')                   /* find end of s */
        i++;

    while ((s[i++] = t[j++]) != '\0')       /* copy t */
        ;
}
