← Back to archive

Stdle #82 · modern · 2026-08-27

What does this C++ snippet output?

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

#include <iostream>
int main() {
int a = 1, b = 2, c = 3;
auto f = [a, &b]() { b += a; return a + b; };
a = 100;
int r = f();
std::cout << r << " " << b << "\n";
}
Modern
4 attempts left

Answer & explanation