1 #include<stdio.h> 2 #define MAXLINE 1000 3 4 int getline(char line[], int maxline); 5 void copy(char to[], char from[]); 6 7 int main() 8 { 9 int len; 10 int max; 11 char line[MAXLINE]; 12 char longest[MAXLINE]; 13 14 max = 0; 15 while ((len = getline(line, MAXLINE)) > 0) 16 if (len > max) { 17 max = len; 18 copy (longest, line); 19 } 20 if (max > 0) 21 printf("%s\n", longest); 22 23 return 0; 24 } 25 26 int getline(char s[], int lim) 27 { 28 int c, i; 29 30 for (i=0; i<lim-1 && (c=getchar())!=EOF && c!='\n'; ++i) { 31 s[i] = c; 32 } 33 if (c == '\n') { 34 s[i] =c; 35 ++i; 36 } 37 s[i] = '\0'; 38 39 return i; 40 } 41 42 void copy (char to[], char from[]) 43 { 44 int i; 45 46 i = 0; 47 while ((to[i] = from[i]) != '\0') 48 49 }
第26行,error: conflicting types for 'getline'.
还是不太清楚。