What is the output of this code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the output of this code?

int i=0; int x=++i-i--; printf("%d",x); please try it in your ide and explain me!!!

27th Feb 2017, 3:46 PM
Upendar Chinna
Upendar Chinna - avatar
3 Answers
0
it's 0. ++i(1) - i-- (1). postfix is applied after the assignment operation is finished
28th Feb 2017, 1:36 PM
Serge Rola
Serge Rola - avatar
0
but I am getting -1 as output ?!
28th Feb 2017, 3:04 PM
Upendar Chinna
Upendar Chinna - avatar
0
or an exit code?)
28th Feb 2017, 3:14 PM
Serge Rola
Serge Rola - avatar