定义函数指针类型,示例代码

来源:互联网 发布:鞋erp软件xyerp 编辑:程序博客网 时间:2024/05/24 04:39
#include <stdio.h>#include <stdlib.h>/*定义函数指针类型,示例代码*///定义一个函数int MyFunc(int a, int b){return a*b;}//这里定义了函数指针类型为EEEtypedef int(*MyFuncPointerType)(int a, int b);int main(int argc, char* argv[]){//函数指针类型实例化MyFuncPointerType eee;//赋值eee = MyFunc;//调用函数指针示例printf("[%d]", eee(2, 3));//getchar();return 0;}

0 0