← Back to archive

Stdle #102 · pointers · 2026-09-16

What does this C snippet output?

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

#include <stdio.h>
int main(void) {
char s[] = "hello world";
char *p = s;
while (*p != ' ') p++;
printf("%ld\n", (long)(p - s));
return 0;
}
Pointers
4 attempts left

Answer & explanation