Why is it difficult to find run time error?
Run time error
Collapse
X
-
The run time error has the address where the program was at the time of the error. Use your debugger find out where in the source code that address is.
Then go into your source code to where the error is occurring and before the error actually occurs you need to capture info on your variables at that time.
For student work a display is OK. For professional work you will need an error handling procedure. I would stick with the easiest thing to do.
Recompile and run the program again and look at your display. The clues to the cause should be there.
Also, have you used your debugger on your code? If not, try it out. Often you can use the debugger to change variable values to cause an error and then you can use the debugger to follow what statements your program executes after the error. Often this leads to making a change in the code to prevent that error at that point.
Comment