Is this a nice hint?
(observe the details)
Code:
#include <iostream>
#include <cstdlib>
using namespace std;
static const int NUM_STRINGS = 4;
int compare(const void* p1, const void* p2);
int main()
{
char* arr_strs[] = { "test", "hi", "hello", "debug" };
qsort(arr_strs, 4 , sizeof(char*), compare);
for(unsigned i = 0; i < NUM_STRINGS; ++i)
{
std::cout<<arr_strs[i]<<" "<<std::endl;
}
return 0;
}
int compare(const void* p1, const void* p2)
{
return strcmp(*(char **)p1, *(char **)p2);
}