Advertisement
vim_fans

Untitled

Sep 24th, 2021
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.39 KB | None | 0 0
  1. int main()
  2. {
  3.  
  4.     int len;    /* current line length */
  5.     int max;    /* maximum length seen so far */
  6.     char line[MAXLINE];     /* current input line */
  7.     char longest[MAXLINE];  /* longest line saved here */
  8.  
  9.     max = 0;
  10.     while((len = getlines(line, MAXLINE))>0)
  11.         if(len > max){
  12.             max = len;
  13.             copy(longest, line);
  14.         }
  15.     if(max > 0)   /* there was a line */
  16.         printf("%s", longest);
  17.     return 0;
  18.  
  19.  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement