GDB and Valgrind are tools which may help you debugging your program and finding possible memory leaks and such.
$ gcc -g3 -Wall -Wextra -std=c99 -o main main.c
$ gdb main
(gdb) help |command|
(gdb) breakpoint main.c:5
(gdb) run
(gdb) watch my_var
(gdb) print/d my_var
NOTE: Here, you may use d for int, s for char*, c for char, etc.
(gdb) info breakpoints
(gdb) info watchpoints
(gdb) delete my_var
(gdb) finish
(gdb) step
(gdb) next
(gdb) stacktrace
(gdb) where
After above compilation, run:
$ valgrind --leak-check=full -v ./main
NOTE: The -v flag will give some verbose output. Feel free to remove that flag if it's too much information for you.