I'm trying to use std::sort to sort an array of C strings. Here's what I've done:
const char *tab[5];
//then fill up the tab
sort(tab, tab+5);
This doesn't seem to work. I've also tried using sort(tab, tab+5, strcmp), which worked, but when I put it into a function, the array remains unchanged. Sorting function:
void sortfunc (const char *tab[], int n){
filltab(tab, n); //n is the ammount of strings
sort(tab, tab+n, strcmp);
}
What's wrong with my code?