how to find where segmentation fault occurs code example
Example 1: segmentation fault
Segfaults are caused by a program trying to read or write an illegal memory location
Example 2: segmentation fault
A segmentation fault (aka segfault) is a common condition that causes programs
to crash; they are often associated with a file named core.
Segfaults are caused by a program trying to read or write an illegal memory
location
Example 3: how to know where segfaut is c
gcc program.c -g
Example 4: how to know where segfaut is c
$ gdb ./a.out
(gdb) run
<segfault happens here>
(gdb) backtrace
<offending code is shown here