diff --git a/14-char-arrays.c b/14-char-arrays.c index 1b0ef12..b528e89 100644 --- a/14-char-arrays.c +++ b/14-char-arrays.c @@ -1,5 +1,6 @@ #include #define MAXLINE 1000 /* maximum input line size */ +#define MINLINE 81 int getline(char line[], int maxline); void copy(char to[], char from[]); @@ -21,13 +22,9 @@ main() if (c == '\n') ++len; } - if (len > max) { - max = len; - copy(longest, line); - } + if (len >= MINLINE) + printf("%s", line); } - if (max > 0) - printf("%s", longest); return 0; }