The first rule of debugging: "If it's weird, it's memory."
You have to remember, a segmentation fault is just a form of undefined behavior. You can use a dynamic analyzer, such as Valgrind, to dial in on the exact part of the your code with the problem.
Look especially for the following "hot spots" for undefined behavior:
Dereferencing pointers.
Dynamic allocation.
Passing by or returning a reference.
Traversing array-like structures, such as C-strings.
The first rule of debugging: "If it's weird, it's memory."
You have to remember, a segmentation fault is just a form of undefined behavior. You can use a dynamic analyzer, such as Valgrind, to dial in on the exact part of the your code with the problem.
Look especially for the following "hot spots" for undefined behavior:
A while back, I wrote up a big list of common reasons for segmentation faults. It might be helpful.