← Back to archive

Stdle #157 · modern · 2026-11-10

What does this C++ snippet output?

A past puzzle — fully playable. 4 attempts, hints on wrong guesses.

#include <iostream>
int main() {
int n = 10;
auto f = [&n](int x) { return x + n; };
n = 100;
std::cout << f(5) << "\n";
}
Modern
4 attempts left

Answer & explanation