Build your application with debug symbols and use a debugger... If you didn't use one before, try and IDE with a graphical interface for 'gdb' like Qt Creator or Code::Blocks. After you loaded your project, put a breakpoint in the function that causes the segfault and run the code line-by-line until you get the faulty instruction.
You can use gdb from command line like this:
Code:
gdb <your-exe>
type 'continue' to skip the first breakpoint
do something that triggers the segmentation fault
type 'backtrace' to see the callstack
Also, your printf line is missing a '%' for the format specifier.