C++ qsort usage example

Date: 2016-03-19
#include 
#include 
#include 

using namespace std;

int compareStr(const void* a, const void* b)
{
    return strcasecmp(*(const char **)a, *(const char **)b);
}

int random(int max)
{
    return rand() % max;
}

char* genRandom()
{
    const char* randomChars = "0123456789abcdefghijklmnopqrstuvwqyzABCDEFGHIJKLMNOPQRSTUVWQYZ";
    int s = random(10)+4;
    char* result = (char*)malloc(sizeof(char)*(s+1));
    for(int i=0;i
1450cookie-checkC++ qsort usage example