← Back to archive

Stdle #140 · pointers · 2026-10-24

What does this C snippet output?

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

#include <stdio.h>
int main(void) {
int a[6] = {2, 4, 6, 8, 10, 12};
int *p = a;
int *q = a + 5;
int mid = *(p + (q - p) / 2);
printf("%d\n", mid);
return 0;
}
Pointers
4 attempts left

Answer & explanation