← Back to archive

Stdle #116 · modern · 2026-09-30

What does this C++ snippet output?

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

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

Answer & explanation