[ create a new paste ] login | about

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

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

static void blah(int i)
{
    printf("Hello, World! %d\n", i);
}

typedef void (*fn_ptr)(void);
static fn_ptr get_blah(void)
{
    return &blah;
}

int main()
{
    void (*my_fn)(int) = NULL;
    my_fn = get_blah();
    my_fn(10);

    return 0;
}


Output:
1
Hello, World! 10


Create a new paste based on this one


Comments: