rendered paste body#include <stdio.h>
#define MAXLEN 20
void strcat2(char *ps, char *pt);
void getline2(char *s,char *t);
int main()
{
char t[MAXLEN];
char s[MAXLEN];
getline2 (s,t);
printf ("%s",s);
return 0;
}
void getline2(char *ps,char *pt)
{
int i = 0, c;
while((c = getchar() ) !=EOF){
*pt++=c;
if ( *--pt == '\n'){
strcat2(ps, pt);
i=0;
}
}
}
int s_index = 0;
void strcat2(char *ps, char *pt)
{
ps += s_index;
while (s_index < MAXLEN && (*ps++ = *pt++) != '\n')
s_index++;
/* The '\0' character (0), signifies the end of a string. */
*ps = '\0';
}