← Back to archive

Stdle #124 · storage · 2026-10-08

What does this C snippet output?

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

#include <stdio.h>
int fib(void) {
static int a = 0, b = 1;
int t = a;
a = b;
b = t + b;
return t;
}
int main(void) {
for (int i = 0; i < 5; i++)
printf("%d ", fib());
printf("\n");
return 0;
}
Storage
4 attempts left

Answer & explanation