← Back to archive

Stdle #52 · classes · 2026-07-28

What does this C++ snippet output?

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

#include <iostream>
int main() {
int x = 4;
int& r1 = x;
int& r2 = r1; // another alias to x
r2 = 99;
std::cout << x << " " << r1 << "\n";
return 0;
}
Classes
4 attempts left

Answer & explanation