XP error messages
I have written a program in C which runs correctly and I can see all the correct output in the console window that I would expect. But at the very end when the program should end I get a Microsoft error box "myprogram.exe has encountered a problem and needs to close. We are sorry for the inconvenience."
The console window then says "*** process returned -1073741818 ***".
Why is it returning this number? The last line of my main function says
so I would expect it to return 0.
Any thoughts? :confused:
Sounds like stack corruption - you're doing bad things in your program :)
> The console window then says "*** process returned -1073741818 ***".
The first thing you need to do with such numbers is convert them into hexadecimal.
For example, that is 0xc0000006.
Googling around suggests that this is some kind of memory fault.
My guess would be that you've managed to corrupt the memory through bad use of new/delete, and it's only in the final tidy up code (post main) that the problem is actually noticed. And when it is, the normal exit becomes an exception exit, and you get the popup and weird numbers.