求助,函数声明出现array type has incomplete element type的编译报错
											 程序代码:
程序代码:
#include<stdio.h>
#include<string.h>
#define MAXLINE 40
char * s_gets( char * st , int n);
int sort_max_value(struct book str[],int n);
struct book
{
    char title[MAXLINE];
    float value;
};
int main()
{
    struct book library[MAXLINE];
    int maxbook;
    scanf("%d",&maxbook);
    int index;
    for( index = 0 ; index < maxbook ; ++index)
    {    
        scanf("%s",&library[index].title);
        //s_gets( library[index].title, MAXLINE);
        while( getchar() != '\n')
            continue;
        scanf("%f",&library[index].value);
    }
    sort_max_value(library,maxbook);
    printf("highest price: %.1f, %s\n",library[maxbook-1].value,library[maxbook-1].title);
    printf("highest price: %.1f, %s\n",library[0].value,library[0].title);
} 
char * s_gets( char * st, int n)
{
    char * rev_val;
    char * find;
    rev_val = fgets(st,MAXLINE,stdin);
    if(rev_val)
    {    
        find = strchr( st , '\n');
        if(find)
            *find = '\0';
        else
            while( getchar() != '\n')
                continue;
    }
    return rev_val;
}
int sort_max_value( struct book str[],int n)
{
    int i,k;
    float temp_value;
    char temp_ch[MAXLINE];
    for( i = 1 ; i < n ; ++i)
    {
        temp_value = str[i].value;
        strcpy(temp_ch,str[i].title);
        for( k = i ; k > 0 && str[k-1].value > temp_value ;--k)
        {
            str[k].value = str[k-1].value;
            strcpy(str[k].title,str[k-1].title); 
        }
        str[k].value = temp_value;
        strcpy(str[k].title,temp_ch);
    }
}
代码如上,在dev上是没有报错可以正常编译运行,可以一旦到了学校的OJ上就直接编译报错
贴出报错
 程序代码:
程序代码:
a.c:5:32: error: array type has incomplete element type
 int sort_max_value(struct book str[MAXLINE],int n);
                                ^
a.c:5:27: warning: ‘struct book’ declared inside parameter list [enabled by default]
 int sort_max_value(struct book str[MAXLINE],int n);
                           ^
a.c:5:27: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
a.c: In function ‘main’:
a.c:20:3: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘char (*)[40]’ [-Wformat=]
   scanf("%s",&library[index].title);
   ^
a.c:26:2: error: type of formal parameter 1 is incomplete
  sort_max_value(library,maxbook);
  ^
a.c:26: confused by earlier errors, bailing out
Preprocessed source stored into /tmp/ccO6HnKI.out file, please attach this to your bugreport.感觉是不同的C版本不一样导致的,但是不知道怎么修改(晕)



 
											





 
	    

 
	

