Gcc is a command line C compiler that takes C source files as input, compiles them into an executable, and outputs an executable file by default called a.out. Gdb is a command line debugger that allows stopping a program at breakpoints to examine variables and state. To compile and run a simple "hello world" C program with gcc and optionally debug it with gdb, gcc is used to compile the source file into an executable and gdb allows setting breakpoints and examining variables when the program is run.