. What is the output when the following code segment is executed?
main )
{
int a = 20;
int b = 30;
printf("%d", a++, ++b);
}
(a) 20,30
(b) 21,31
(c) 0,31
(d) 19,29
Answers
Answered by
0
note:the options are wrong..
Answer:
o/p
%d 20 31
Explanation:
a++ is given,Therefore print the value of variable.
++b is given, Therefore print the value of variable +1 .
HOPE IT HELPS..IF SO..
PLS MARK ME AS BRAINLIEST..
THANK YOU..
Answered by
0
Option A) 20,30
The output when the following code segment is executed.
C Code
main
{
int a = 20;
int b = 30;
printf("%d", a++, ++b);
}
Output
20,30
- The increment operator has two different uses in C: preincrement and postincrement. Pre-Increment places the variable before the operator plus sign (++). A variable's value is increased before being transferred to another variable. In Post-Increment, the variable is followed by the plus sign (++). Operator before increment: A variable's value is increased before being utilised in an expression using a pre-increment operator.
- Value is incremented before being used in the expression in the Pre-Increment. After an expression using post-increment has been fully executed, the value of an operand (variable) may be increased using the post-increment operator (++). It indicates that the value of the operand (variable) is used first when we use the post-increment (++) operator, and then the operand is increased.
#SPJ3
Similar questions