[Solved] I am getting segmentation fault for merge sort [closed]


That would be a way to go on Linux:

  1. Compile your program with debug info (g++ -g merger_sort.cpp -o merger_sort)
  2. Load it in debuger: >>> gdb merge_sort
  3. Run it: (gdb) run.

You will see:

Program received signal SIGSEGV, Segmentation fault.
0x0000000000400b1e in merge_sort (A=0x7ffffffddda0, p=0, r=1)
  1. look at the position in the code: (gdb) layout src
  2. look at the backtrace: (gdb) bt

It is pretty long… So you have a stack overflow:) USe debugger too see why.

solved I am getting segmentation fault for merge sort [closed]