typedef struct hello {
int (*someFunction)(int parameter);
} hello;
int foo(int parameter) {
return parameter;
}
hello Hello() {
struct hello aHello;
aHello.someFunction = &foo;
return aHello;
}
int main()
{
struct hello aHello = Hello();
printf("Print hello: %d\n", aHello.someFunction(3));
return 0;
}
Result :
Print hello: 3
Reference:
0 意見:
張貼留言