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 from the Wikipedia article yet neither work.
The first one:
char *s = "Hello World!";
*s = 'H';
And the second example:
int main(void)
{
main();
}
EDIT: I'm using Ubutnu 9.10 and g++
as my compiler. Can anyone show me some code that is guaranteed to segfault?