c 2b 2b functions inside functions

Solutions on MaxInterview for c 2b 2b functions inside functions by the best coders in the world

showing results for - "c 2b 2b functions inside functions"
Giorgio
26 Feb 2020
1int main() {
2    // This declares a lambda, which can be called just like a function
3    auto print_message = [](std::string message) 
4    { 
5        std::cout << message << "\n"; 
6    };
7
8    // Prints "Hello!" 10 times
9    for(int i = 0; i < 10; i++) {
10        print_message("Hello!"); 
11    }
12}
13