A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-106.c
1#include<stdio.h>
2intmain(void){
3unsignedlen=0;
4for(inti=0;i<(int)len-1;i++)
5printf("x");
6printf("done\n");
7return0;
8}
Numbers
Answer & explanation
Console output
done
Why
Writing len - 1 directly would compute 0u - 1 == UINT_MAX (a near-infinite bound), the classic unsigned-underflow loop bug. The (int)len cast converts to signed first, so the bound is the int -1 and the loop condition i < -1 is immediately false. The program prints only "done".