Multiple choice technology programming languages

#include main(){ static int a[20]; int i=0; a[i]=i++; printf("%d %d %d",a[0],a[1],i); }

  1. 0 0 0

  2. 0 1 0

  3. 0 0 1

  4. 0 1 1

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The static array a[] is initialized to 0. The statement a[i]=i++ where i=0 has undefined behavior in C (modifying and reading i in same expression), but in practice: a[0] is assigned 0, then i increments to 1. The output shows a[0]=0, a[1]=0 (unchanged static value), and i=1.