[ create a new paste ] login | about

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

C, pasted on Dec 10:
#include<stdio.h>
int main()
{
        int a = 5;
        int *p;

        p = &a;
        printf("%d\n", *p);
        printf("%p\n", p);
        printf("\n");

        *p = *p + 1;
        printf("%d\n", *p);
        printf("%p\n", p);
        printf("\n");

        p = p + 1;
        printf("%d\n", *p);
        printf("%p\n", p);
        printf("\n");

        p = p + 1000000;
        printf("%d\n", *p);
        printf("%p\n", p);
        printf("\n");

        return 0;
}


Output:
1
Segmentation fault


Create a new paste based on this one


Comments: