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 @   阑珊一舞  阅读(159)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示