From: In this article, let us discuss how to debug a c program using gdb debugger in 6 simple steps. ### Write a sample C program with errors for debugging purpose To learn C program debugging, let us create the following C program that calculates and prints the factorial of a number. However this C program contains some errors in it for our debugging purpose. $ vim factorial.c # include int main() { int i, num, j; printf ("Enter the number: "); scanf ("%d", &num ); for (i=1; i