To determine the output of the given C program, let's go through the code step by step:
- Initialize the variable
a
with a value of 10.
- Declare the variable
b
.
- Assign the value of
a
(10) to b
and then increment the value of a
by 1 using the post-increment operator (a++
).
- After this step,
a
becomes 11 and b
becomes 10.
- Print the values of
a
and b
using printf()
function with the format string "a=%d b=%d"
.
- The values of
a
and b
are 11 and 10 respectively.
Therefore, the correct answer is:
C. a=11 b=30