It doesn't appear that you return out of the main function at the end of the program. Perhaps a simple
before your last closing brace may help here.
Okay, I just re-read your post and you said that it crashes *before* you get your answer. So the ending return statement won't help here - it is a good idea to put it in though.
You don't really need a return statement, though. It will return at the end of the function, implicitly.
To clarify: the program will still work without it, so it's not a bug.