Devc programming software program how to debug devc debugging steps graphic text method tutorial
Devc is a very good programming software, for its debugging many friends do not know very well, let's take a look.
How to debug devc
First of all, what is debugging? Debugging (also known as debug) is a way to find the exact location of an error based on changes in data in a program. Although many editors have their own error correction function, it can only find grammatical errors, not logic and definition errors, especially when we are compiling some rather complex programs. We need to learn how to debug. Next I'll briefly show you how to use the debugging capabilities of DevC++.
# # framing error range
Next we will use Debug to correct relatively simple definition errors in editing.
First of all, let's write the following program
The b defined by double in this program should have been declared using% lf, but the program in the figure mistakenly uses% f. The error correction function of the error editor can not be found, but it will affect the output of the program.
According to the program in the figure, if the program is correct, the final output should be
Then it is obvious that the output of C is different from the reality, but the result of C is related to the values z and b, so we can't help but infer that the problem lies with z or b.
# # start and end 1
When the program we design is quite complex, it is impossible for us to debug one by one from beginning to end, so we have to learn how to set the starting point and the end point.
First of all, let's click the button below to adjust to the debug interface to the debug interface.
Then look for the place where the wrong location might start (that is, where z is defined), and click the number to the left of the line to set it as the starting point.
By the same token, we click on the number to the left of the output C line, which sets the line as the end point, the start point and the end point.
When starting debug, the program will run line by line when it reaches the starting point, and when we want the program to continue, we must click the next line item in the Debug bar