← Back to archive

Stdle #21 · overload · 2026-06-27

What does this C++ snippet output?

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

#include <iostream>
template <typename T> void f(T) { std::cout << "template\n"; }
void f(int) { std::cout << "exact\n"; }
int main() {
f(5);
}
Overload
4 attempts left

Answer & explanation