[ create a new paste ] login | about

Link: http://codepad.org/wGa2VjI4    [ raw code | output | fork ]

C, pasted on Mar 17:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <stdio.h>

struct foo
{
    int i;
};

void pointers_are_unsafe(struct foo *sc)
{
	printf("About to print! Pointers are safe, right?\n");
   	fflush(stdout);   
	printf("%d",sc->i);
}

int main ()
{
	struct foo *sc = NULL;
	pointers_are_unsafe(sc);
	return 0;
}


Output:
1
2
3
About to print! Pointers are safe, right?

Segmentation fault


Create a new paste based on this one


Comments: