Answer to Question #154288 in C for what is the output of the snippet?

Question #154288

int a=6,b=3;

printf("%d",(++a*b--));


1
Expert's answer
2021-01-08T08:38:56-0500

++a -- increments value of a and returns it's new value

printf("%d", ++a); //7

b-- -- decrements value of b and returns it's old value

printf("%d", b--); //3


So, the value of (++a*b--) equals (a+1)*b = 21

So the result of this line of code

printf("%d", (++a*b--));

would be 21


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS