close
#include <stdio.h>
#include <stdlib.h>
typedef int (*math)(int a,int b);
typedef struct{
math data_handler;
}fun;
int plus(int a,int b)
{
return (a+b);
}
int minus(int a,int b)
{
return (a-b);
}
int main(int argc, char *argv[])
{
fun ptr;
ptr.data_handler=plus;
printf("plus=%d\n",ptr.data_handler(5,2));
ptr.data_handler=minus;
printf("minus=%d\n",ptr.data_handler(5,2));
system("PAUSE");
return 0;
}
全站熱搜
留言列表