[ create a new paste ] login | about

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

C, pasted on Oct 14:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <stdio.h>
//returning a pointer
int *fun()
{
    int i = 10;
    printf ("%u\n",i);
    printf ("%u\n",&i);
    return &i;
}
int main()
{
    int *p;
    p = fun();
    fflush(stdout);
    printf ("p = %u\n", p);
    printf ("i = %u \n",*p);
    return 0;
}


Output:
1
2
3
4
10
3213937580
p = 3213937580
i = 3213937580 


Create a new paste based on this one


Comments: