Multiple choice general knowledge science & technology

#include void main() { int i=1; printf("%d",++i); printf("%d",i++); } choose output of the above program

  1. 2,2

  2. 1,3

  3. 2,3

  4. 1,2

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

++i is pre-increment (increments first, then returns new value), so i becomes 2 and prints 2. i++ is post-increment (returns current value, then increments), so it prints 2 again (current value) then increments to 3. Output: 2,2. Note: void main() is non-standard but works in some compilers.