0
 #include<stdio.h> #include<conio.h> void main(){ int a,i=4; a=- -i+- -i+- -5; printf("%d %d",a,i); } return x*3; }
please explain the output of this
5 Answers
0
the output will be 9 2
what --i does is first it decreases i by one then uses its value and what i-- does is it first uses its value then decreases it.....
so here first we have --i so i=3 and 3 is used then it again does --i so now i=2 and then --5 becomes 4.
So a becomes 3+2+4 i.e. 9....
0
A lot of people have this confusion as to when in i++ will the value increment....its rather simple....it increases when the compiler encounters a ;.....example
i=4;
i++// i has the value 4 here
; // after encountering ; it's value becomes 5
0
but the actual answer is 13 4
I didn't get how so please can u interpret that
0
then you must be using a c compiler rather than a c++ compiler as the c compiler doesn't get the meaning of --i
0
but even c compiler will take pre increment right