A past puzzle — fully playable. 4 attempts, hints on wrong guesses.
stdle-163.c
1#include<stdio.h>
2intmain(void){
3inta=0;
4intr=a++||a++||a++;
5printf("r=%d a=%d\n",r,a);
6return0;
7}
Quirks
Answer & explanation
Console output
r=1 a=2
Why
`||` evaluates left to right with a sequence point after each operand and stops at the first true one. First `a++` yields 0 (a→1, false), second `a++` yields 1 (a→2, true), so `||` stops. The third `a++` is never evaluated. Result is 1, a is 2.