Question Locked

Basic C Coding Help

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
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: http://codepad.org/ZJzaSFAy

3 replies

by tobif

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".

by tony hopkinson

passed back from main

e.g.

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.

This discussion is closed to new replies.