C code output ?

Sachin Jain

Sachin Jain

@sachin-0wuUmc Oct 24, 2024
Hii
Can anyone please explain me the output of this code

int main()
{
int i=0;
while(+(+i--)!=0)
i -= i++;
printf("%d",i);
getchar();
return 0;
}
I found it at :-
#-Link-Snipped-#

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • Varsha0802

    Varsha0802

    @varsha0802-YohNRX Dec 24, 2010

    -32768, I guess, because the loop will not run. Tell me if I am correct or not.
  • deepasri

    deepasri

    @deepasri-6Qfn3L Dec 24, 2010

    output : -1

    in while loop i variable get -1 values then it is true
    next statment balance the value as i = -1
    then print -1 value.
  • Sachin Jain

    Sachin Jain

    @sachin-0wuUmc Dec 24, 2010

    @deepsari,
    You are right its output is -1
    Hey, Can you please explain in some steps...