+ 4
i= i++ + ++i - i-- - --i; why the output of this procces is 0?
need answer immediately
23 Respostas
+ 9
step by step
i=5
i++ means i=5 no change(nc)
++i means previous ++ is 5 turn into 6 then again ++ 7 i=7
i-- nc i=7
--i means previous -- is 7 turn into 6 then again -- 5 i=5
5+(7-7)-5
5-5
0
+ 9
I think that if i=5
i++ in operation 5 is used but i becomes 6
++i is 7
i-- then 7 is used but i becomes 6
--i is 5
so you have 5+7-7-5=0 and when you remove the i-- - --i and run the process i=i++ + ++i; then the result in 5+7=12
+ 7
what is the initial value of i?
+ 7
i new in programming but i think:
int y = ++x; // first: increment x, then: assignment
int y = x++ // firsr: assignment, then: increment x
int i = 5;
i = (i++) + (++i) - (i--) - (--i)
// a + b - c - d
a = i++ // a = 5, i = 6
b = ++i // b = 7, i = 7
c = i-- // c = 7, i = 6
d = --i // d = 5, i = 5
// i = 5 + 7 - 7 - 5 = 0
+ 6
right is
i++ mean no change
++i mean increment
vice versa in -- decrement
its count to right to left not left to right
5+(6-6)-5
5-5
0
+ 6
mark ur best ans @name
+ 6
right is
the i=5;
i++ is 5
++i is 7
i-- is 7
--i is 5?
+ 5
check right
previous was wrong
+ 5
because its post decrement then stay last value.. and then come pre decrement so it become 5 again āŗ
+ 5
i=(5+5-5-5)+1-1=0
so,the output will be zero
always remember before doing addition or substraction in these kind of problems do preincrement for sure,at the end do the post increment.
+ 5
its count to right to left not left to right
+ 5
no problem
love ur community
do some for ur community then better sololearn āŗ
+ 4
sorrt for incompletw question
+ 3
thanks for the answer guys in understand now :) luv u all
+ 2
5
+ 2
i++ is still 5 and ++i will increment to 6?
+ 2
nice but can i ask u why i-- is 6?
+ 2
is*
+ 2
Yeahh i love ur community too .. :)
+ 1
because when i remove the i-- - --i and the i run the process i=i++ + ++i; then the result in 12