how to identify segmentation fault code example
Example 1: how to know where segfaut is c
gcc program.c -g
Example 2: how to know where segfaut is c
$ gdb ./a.out
(gdb) run
<segfault happens here>
(gdb) backtrace
<offending code is shown here
gcc program.c -g
$ gdb ./a.out
(gdb) run
<segfault happens here>
(gdb) backtrace
<offending code is shown here