Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const char *tab[5];
- //then fill up the tab
- sort(tab, tab+5);
- void sortfunc (const char *tab[], int n){
- filltab(tab, n); //n is the ammount of strings
- sort(tab, tab+n, strcmp);
- }
- bool cmp(char const *lhs, char const *rhs) {
- return strcmp(lhs, rhs) < 0;
- }
- std::sort(tab, tab + n, cmp);
- std::sort(tab, tab + n, [](char const *lhs,
- char const *rhs) { return strcmp(lhs, rhs) < 0; });
- std::vector<std::string> v = ...;
- std::sort(std::begin(v), std::end(b));
- bool cmp(const char *str1, const char *str2){
- if(strcmp(str1, str2)<0) return true;
- else return false;
- }
- sort(tab, tab+5, cmp);
Add Comment
Please, Sign In to add comment