While 'gdb' is command line based there are lets of graphical interfaces. In particular 'ddd' is really useful for examining complex data structures.
Gdb is most useful when your code is compiled with the '-g' flag (on gcc) which causes the compiler to add extra information to the executable; saying which bits of code correspond to which lines of source. Note this can get confusing when optimisation is also on.
So compile the example program 'seggy.c' with:
gcc -g seggy.c -o seggy