🎴 Flashcard Mode
Java and C++ Programming Fundamentals
Card1 / 20
Mastered0
Review0
QuestionClick to flip
1)main() { int i = 5; printf(“%d %d %d %d %d”,i++,i--,++i,--i,i); }
AnswerClick to flip back
A
4 5 5 4 5
💡 Explanation:
In C, the order of evaluation of printf arguments is unspecified. However, the values are computed right-to-left before printing. Starting from i=5: i++ makes 6, i-- makes 4, ++i makes 5, --i makes 4, and i is 4. But compilers may vary. On systems producing 4 5 5 4 5, this matches option D. This tests understanding of increment/decrement operators and evaluation order.