← Back to archive

Stdle #138 · overload · 2026-10-22

What does this C++ snippet output?

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

#include <iostream>
int g(int x) { return x + 1; }
int g(int x, int y) { return x + y; }
int main() {
std::cout << g(5) << " " << g(5, 6) << "\n";
}
Overload
4 attempts left

Answer & explanation