CrazyEngineers V4: Early Access

We are developing the next version of CrazyEngineers. If you wish to receive latest updates and early access, click the link below.

  1. Home >
  2. Apps >
  3. Groups >

C code output ?

Question asked by Sachin Jain in #Coffee Room on Dec 25, 2010
Sachin Jain
Sachin Jain · Dec 25, 2010
Rank C2 - EXPERT
Can anyone please explain me the output of this code

int main()
int i=0;
i -= i++;
return 0;
I found it at :-
Interview Question for Software Engineer/Developer (Fresher) about CPuzzles « GeeksforGeeks Posted in: #Coffee Room
Varsha0802 · Dec 25, 2010
Rank C2 - EXPERT
-32768, I guess, because the loop will not run. Tell me if I am correct or not.
deepasri · Dec 25, 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 · Dec 25, 2010
Rank C2 - EXPERT
You are right its output is -1
Hey, Can you please explain in some steps...
Divisha Madupalli
Divisha Madupalli · Feb 12, 2020
Rank C1 - EXPERT

output is -1

In the while loop, it becomes -1 then the changes do not affect it because the operations are -1 + 0.

You must log-in or sign-up to reply to this post.

Click to Log-In or Sign-Up