#include using namespace std ; int main() { int counter = 0; // Lambda capturing 'counter' by value and declared mutable auto increment = [counter]() mutable { // 'counter' can be modified inside the lambda because of 'mutable' counter++; cout << "Inside lambda: counter = " << counter << endl; }; increment(); // Call the lambda increment(); // Call the lambda again increment(); // Call the lambda a third time cout << counter << endl; return 0; }