← Back to archive

Stdle #41 · containers · 2026-07-17

What does this C++ snippet output?

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

#include <iostream>
#include <vector>
int main() {
std::vector<int> v = {1, 2, 3};
v.clear();
std::cout << v.empty() << " " << v.size() << "\n";
}
Containers
4 attempts left

Answer & explanation