相关疑难解决方法(0)

C++排序字符串数组

我正在尝试排序一个字符串数组,但它没有排序任何东西....我做错了什么?

string namesS[MAX_NAMES];

int compare (const void * a, const void * b){
    return ( *(char*)a - *(char*)b );
}


void sortNames(){

    qsort(namesS, MAX_NAMES, sizeof(string), compare);
}
Run Code Online (Sandbox Code Playgroud)

c++ sorting

18
推荐指数
3
解决办法
6万
查看次数

标签 统计

c++ ×1

sorting ×1