error: invalid use of incomplete type 'struct word'|
发生错误的程序:
#include <stdio.h>
#include <string.h>
#include <algorithm>
int cmp(const void* x,const void* y)
{
struct word* xx=(word*)x;
struct word* yy=(word*)y;
return strcmp(xx->a,yy->a);
}
struct word
{
char a[26];
}w[1000];
int main()
{
……
}
错因:结构体的声明和定义在cmp函数之后