निम्नलिखित कोड का आउटपुट क्या होगा?
What will be the output of the following code ?
#include <stdio.h>
void solve() {
int b = 4;
int res = b++ + ++b + ++b;
printf("%d", res);
}
int main() {
solve();
return 0;
}
A
12
B
15
C
17
D
20
Explanation
The code calculates the result of the expression b++ + ++b + ++b, where b starts at 4:
b++uses the value 4, then incrementsbto 5.++bincrementsbto 6 and uses that value.++bincrementsbto 7 and uses that value.
The sum is 4 + 6 + 7 = 17.
Output: (C) 17.
Correct Answer: C) 17