← Back to archive

Stdle #89 · storage · 2026-09-03

What does this C snippet output?

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

#include <stdio.h>
int peek(void) {
static int p = 0;
return p;
}
int set(int v) {
static int p = 0;
p = v;
return p;
}
int main(void) {
int s = set(8);
printf("%d %d\n", s, peek());
return 0;
}
Storage
4 attempts left

Answer & explanation