I apologize for the brevity of the message.
I have an array of records. I want to sort it descending wrt one of its keys. Entries "are not unique.
compare qsort function:
int cmp(const record* rec1, const record* rec2)
{
return rec2->key - rec1->key;
}
compare the function std :: sort:
bool operator()(const record& rec1, const record& rec2)
{
return rec1.key > rec2.key;
}
Will both versions have the same result? I'm not sure if sort / qsort behave the same when keys are equal.
source
share