← Back to archive

Stdle #30 · classes · 2026-07-06

What does this C++ snippet output?

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

#include <iostream>
int main() {
int x = 50;
const int& cr = x;
auto y = cr; // auto drops const
y += 5;
std::cout << y << " " << x << "\n";
return 0;
}
Classes
4 attempts left

Answer & explanation