Post

함수 포인터 반환하는 함수

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <stdio.h>

void callback(void (*cb)())
{
        cb();
}

void test()
{
        printf("hello world!\n");
}

void (*test2(int a))()
{
        printf("%d\n", a);
        return test;
}

int main(int argv, char** args)
{
        callback(test);
        callback(test2(1));
}

void (*)() -> void (* 함수원형 ) ()
This post is licensed under CC BY 4.0 by the author.

Trending Tags