You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
294 B
Markdown
18 lines
294 B
Markdown
10 years ago
|
# This will just crash
|
||
|
|
||
|
```bash
|
||
|
$ gcc -xc - <<APP
|
||
|
#include <stdio.h>
|
||
|
int main() {
|
||
|
int *p = NULL;
|
||
|
printf("Before pointer dereference\n");
|
||
|
*p = 1;
|
||
|
printf("After pointer dereference\n");
|
||
|
return 0;
|
||
|
}
|
||
|
APP
|
||
|
$ ./a.out
|
||
|
Before pointer dereference
|
||
|
Segmentation fault (core dumped)
|
||
|
```
|