有关函数指针用作函数参数的问题???????????????、
//输一个数组list,要求元素从大到小排出来//#include<iostream.h>
#include<stdlib.h>
#include<string.h>
int compare(const void* a,const void* b);
char list[5][4]={"cat","car","cab","cap","can"};
int main()
{
qsort((void*)list,5,sizeof(list[0]),compare);
for(int i=0;i<5;i++)
cout<<list[i]<<endl;
return 0;
}
int compare(const void* a,const void* b)
{
return strcmp((char* *)a, (char* *)b);
}
VC6提示错误:F:\C++文件\p180\pp180.cpp(19) : error C2664: 'strcmp' : cannot convert parameter 1 from 'char ** ' to 'const char *'
求各位大神分析并改正,万分感激????????????????