Yesterday during the compilation of the following code in the error message, please master answer
#include
1000/* # define MAXLINE maximum input line length */
Int getline (char line [], int maxline);
Void copy (char to [], char from []);
/* print the longest input line */
The main ()
{
int len;/* current line length */
int max;/* maximum length seen so far */
Char line [MAXLINE];/* current input line */
Char longest [MAXLINE];/* longest line saved here */
Max=0;
While ((len=getline (line, MAXLINE)) & gt; 0)
If (len & gt; Max) {
Max=len;
Copy (longest, line);
}
If (Max & gt; 0)/* there was a line */
Printf (" % s ", the longest);
return 0;
}
/* getline: read a line into the s, return length */
Int getline (char [s], int lim)
{
C, int I;
For (I=0; i
If (c=='\ n') {
S [I]=c;
+ + I;
}
S [I]='\ 0';
return i;
}
/* copy: copy 'from' into 'to'; Assume the to is big enough */
Void copy (char to [], char from [])
{
int i;
i=0;
While ((to [I]=the from [I])!='\ 0')
+ + I;
}
CodePudding user response:
Online, such as the great god for help