How to solve this pre-increament in c? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to solve this pre-increament in c?

I am unable to get the correct answer to this question. Can anyone help me with stepwise explanation? #include <stdio.h> #include<math.h> int main() { int a=12,b; b=++a + ++a + ++a; printf("%d %d", a,b); return 0; }

31st Aug 2018, 3:09 PM
Akshay Kumbhar
Akshay Kumbhar - avatar
6 Answers
+ 3
b = 13 + 14 + 15 Output should be 15 42 I don't know why it's giving 15 43
31st Aug 2018, 4:35 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 2
put b = a+3
31st Aug 2018, 3:37 PM
I Am Arthur
I Am Arthur - avatar
+ 1
Tind Indeed, i agree with you (onc again😜). Akshay It seems not well written and logically not the best, that way. At all. Thx for sharing. ☺
31st Aug 2018, 7:14 PM
Angelo Sorte
Angelo Sorte - avatar
0
I want explanation for GCC compiler
31st Aug 2018, 4:30 PM
Akshay Kumbhar
Akshay Kumbhar - avatar
0
I'm not getting how it's giving 43
31st Aug 2018, 4:49 PM
Akshay Kumbhar
Akshay Kumbhar - avatar
0
This was asked in the interview, thats why I am asking for
31st Aug 2018, 5:06 PM
Akshay Kumbhar
Akshay Kumbhar - avatar