OK for whatever reason I\'m having trouble causing a seg fault. I want to produce one so that I can use gdb to see how to debug one. I have tried both examples
It impossable to try and reliable do it dereferencing pointers.
This is because how the application handles memory can vary from compiler to compiler also across the same compiler with different options (debug/release mode handeled differently).
What you can do is explicitly raise the segfault using a signal:
#include
int main()
{
raise(SIGSEGV);
}