Basic C Coding Help

By cow_tipper8282 ·
Can someone help me find the error in this code? It creates the proper output but then exits unsuccessfully, and I can't figure out why. The code and output can be seen here:

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

How does the compiled program behave outside of the dev environment?

by TobiF In reply to Basic C Coding Help

Maybe this is just your compiler or debugger telling you that everything is ok?

Or maybe this particular environment demands that you just don't finish your code, but rather call exit_success?

I've never programmed in c, so I may be completely wrong, this is mere "food for thought".

Collapse -

Hmm that sort response is usually

by Tony Hopkinson In reply to Basic C Coding Help

passed back from main


int main()
return 0;

is success, non zero values are an error code.

Seeing as you havenlt defined main as having a result, I can only assume your environment is coughing up some spurious value, because it expects main to have a return type.

Related Discussions

Related Forums