Skip to content
Quiz · Functions · lesson 10 of 11

Quiz — what the lambda captures

What does the program print?

C++
#include <iostream>

int main() {
    int x = 1;
    auto get = [x]() { return x; };
    x = 5;
    std::cout << get() << ' ' << x;
}