C 函数指针的用法

#include <stdio.h>
#include <stdlib.h>

typedef struct DataNode
{
int (*handle)();
}tDataNode;

int print()
{
printf("Hello World!\n");
return 0;
}

int main()
{
int a = 0;
tDataNode * pData = NULL;
pData= (tDataNode *) malloc (sizeof(tDataNode));
pData->handle = print;
pData->handle();
return 0;
}

posted @ 2014-09-22 16:59  阑珊一舞  阅读(156)  评论(0编辑  收藏  举报