0
Answer this question
int a=2 printf("%d",a++ - ++a);
4 odpowiedzi
+ 2
1. Firstly, you should separate the two statements by ;
int a = 2;
printf("%d, a++ - ++a) ;
2. The increment works like this
++a is increment before using.
a++ is using before increment.
3. Because a is 2, a++ is 2, and a becomes 3
4. Because a is 3, ++a is 4, and a becomes 4
So a++ - ++a is 2 - 4,
Output - 2
+ 2
Please use relevant tags though.
Like
C, printf, a++
0
The answer is -2!
I think it's not a problem!! This Q&A discussions section is only for programming related problems and questions and you can ask that here!!
And your question related tutorial of SoloLearn!
https://www.sololearn.com/learn/C/2917/?ref=app
By the way, you can suggest this a quiz in the quiz factory of SoloLearn!