0

on cppreference site about std:strcmp this example is used in it calling to sort function

 std::vector<const char*> cats {"Heathcliff", "Snagglepuss", "Hobbes", "Garfield"};
    std::sort(cats.begin(), cats.end(), [](const char *strA, const char *strB) {
        return std::strcmp(strA, strB) < 0;
    }); 
 
    for (const char *cat : cats) {
        std::cout << cat << '\n';
    }

I like to know what is

[](const char *strA, const char *strB) 
{..}

third parameter in std::sort call

is this array of function call with body of a function. What they are called

user786
  • 3,502
  • 3
  • 28
  • 56

0 Answers0