diff --git a/1-16.c b/1-16.c new file mode 100644 index 0000000..2fa7dcd --- /dev/null +++ b/1-16.c @@ -0,0 +1,45 @@ +#include +#define MAXLINE 1000 /* maximum input line length */ + +/* ggetline: read a line into 'line', return length */ +int ggetline(char line[], int maxline){ + int c, i; + for (i=0; (c=getchar()) != EOF && c!='\n'; ++i){ + if (i0){ + if (len > max){ + max = len; + copy(longest, line); + } + } + if (max > 0){ /* there was a line */ + printf("%s\n", longest); + printf("length: %d\n", max); + } + return 0; +}