Return to site

Compile c program in dos number

broken image

So before starting up the program, let us place the following break point in our program. While executing the program, the debugger will stop at the break point, and gives you the prompt to debug. Places break point in the C program, where you suspect errors. Set up a break point inside C program Syntax: Launch the C debugger (gdb) as shown below. Note: The above command creates a.out file which will be used for debugging as shown below. This allows the compiler to collect the debugging information. Compile the C program with debugging option -gĬompile your C program with -g option. Let us debug it while reviewing the most useful commands in gdb. Printf('The factorial of %d is %d\n',num,j) However this C program contains some errors in it for our debugging purpose. To learn C program debugging, let us create the following C program that calculates and prints the factorial of a number.

broken image

Write a sample C program with errors for debugging purpose In this article, let us discuss how to debug a c program using gdb debugger in 6 simple steps.

broken image

Earlier we discussed the basics of how to write and compile a C program with C Hello World Program.