include <stdio.h> int main() { int b=7,a; a=b++ + ++b+b++ ; printf ("%d\n",a); return 0; } | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

include <stdio.h> int main() { int b=7,a; a=b++ + ++b+b++ ; printf ("%d\n",a); return 0; }

Explanation please

22nd Oct 2021, 5:19 AM
Palleni Sasidhar
Palleni Sasidhar - avatar
6 Answers
+ 2
#include <stdio.h> int main() { int b = 7, a; a = b++; printf("%d\n",a); a += ++b; printf("%d\n",a); a += b++; printf("%d\n", a); return 0; }
22nd Oct 2021, 5:54 AM
Omkar Kamat
Omkar Kamat - avatar
+ 2
a=b++ + ++b+b++; 1)a=((b++)+(++b))+(b++); 2)++b = 8 3)b++ = 8 4)b++ = 9 5)a=8+8+9 6)a=25 b=10
22nd Oct 2021, 2:47 PM
MJARAB
MJARAB - avatar
+ 1
I am unable to explain via chat therefore i have shared code explaination, if you know use of ++b or b++ then you will understand it. if you dont know about it then do some research
22nd Oct 2021, 5:56 AM
Omkar Kamat
Omkar Kamat - avatar
+ 1
Please always tag the language you're asking about. https://code.sololearn.com/W3uiji9X28C1/?ref=app
22nd Oct 2021, 6:44 AM
Simon Sauter
Simon Sauter - avatar
0
It produces garbage value at the result due to the variable A value is not defined. Just check this link for your understanding about the unary operators in c. https://www.quora.com/What-is-a-a-b-b-if-a-is-4-and-b-is-5/answer/Raghul-A-25?ch=10&oid=300627272&share=8d139834&srid=hqEi0&target_type=answer
23rd Oct 2021, 6:22 PM
Gopinath
Gopinath - avatar
0
25
30th Nov 2022, 6:18 AM
Yogesh waran
Yogesh waran - avatar