我在main函数外定义了这么一段
struct
{
int value;
int cnt;
int child[100];
cmpp();
void paixu()
{
sort(child,child+cnt,cmpp);
}
}node[101];
bool cmpp(int x,int y)
{
return node[x].value>node[y].value;
}
就是这个:
编译过不了,提示大意就是不认识cmpp()这个比较函数。求助各位大大怎么改才可以呢。
完美解决。非常感谢诸位大佬!!
为什么要把cmpp()函数放在结构体内呢?
cmpp()函数不能放到结构体里面,
cmpp()放到struct前面
cmpp()放到struct前面
感谢楼上诸位大佬,放外面测试后已通过!