Question:

What is the output of the following C program segment? 
int j = 7; 
printf("%d, %d", j++, j--);}

Show Hint

For post-increment and post-decrement operators, the value is used before the operation takes place.
Updated On: May 3, 2025
  • 6, 7
  • 7, 7
  • 8, 7
  • 7, 6
Hide Solution
collegedunia
Verified By Collegedunia

The Correct Option is A

Solution and Explanation

The value of \( j \) is printed before and after the increment and decrement operations. The post-increment operator \( j++ \) increments \( j \) after it is evaluated, and the post-decrement operator \( j-- \) decrements \( j \) after it is evaluated.
Thus, the output is \( 6, 7 \).
Thus, the correct answer is \( 6, 7 \).
Was this answer helpful?
0
0

Top Questions on Programming in C

View More Questions