#include <stdio.h>#define MAXLEN 1000void strcat2(char *ps, char *pt);int main(){ char t[MAXLEN]; char s[MAXLEN]; int i = 0, c; while ((c = getchar()) != EOF) { t[i++] = c; /* i is now incremented, so t[i] points to the wrong place. */ if (t[i-1] == '\n') { strcat2(s, t); printf("%s", s); i = 0; } } return 0;}void strcat2(char *ps, char *pt){ /* Copy up to the newline character only (inclusive). */ while ((*ps++ = *pt++) != '\n') ; /* The '\0' character (0), signifies the end of a string. */ *ps = '\0';}