← Back to archive

Stdle #28 · overload · 2026-07-04

What does this C++ snippet output?

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

#include <iostream>
void f(int&) { std::cout << "lvalue\n"; }
void f(int&&) { std::cout << "rvalue\n"; }
int main() {
int x = 5;
f(x);
f(10);
}
Overload
2 lines
4 attempts left

Answer & explanation