← Back to archive

Stdle #156 · classes · 2026-11-09

What does this C++ snippet output?

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

#include <iostream>
int main() {
int x = 8;
int& r = x;
auto a = r; // auto: int, a copy
a = 99;
std::cout << x << " " << a << "\n";
return 0;
}
Classes
4 attempts left

Answer & explanation