码迷,mamicode.com
首页 > 其他好文 > 详细

回调函数案例(一)

时间:2019-04-13 10:34:16      阅读:123      评论:0      收藏:0      [点我收藏+]

标签:结果   print   运行   type   include   clu   val   div   pre   

 1 #include <stdio.h>
 2 
 3 typedef void*(*FUN)(void *) ;
 4 
 5 int test(FUN pfun, void *arg)
 6 {
 7     pfun(arg);
 8     return 0;
 9 }
10 
11 void *fun(void *arg)
12 {
13     int val = (int) arg;
14     printf("val=%d\n", val);
15     return (void *)0;
16 }
17 
18 int main()
19 {
20     test(fun, (void *)100);
21     return 0;
22 }

运行结果是

val=100

回调函数案例(一)

标签:结果   print   运行   type   include   clu   val   div   pre   

原文地址:https://www.cnblogs.com/CodeWorkerLiMing/p/10699832.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!