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

函数指针

时间:2014-08-31 00:18:50      阅读:127      评论:0      收藏:0      [点我收藏+]

标签:style   使用   sp   amp   on   new   c   as   bs   

 

 

函数指针的赋值与使用均有两种方式:

 

int max(int a, int b)

{

     return a>b ? a: b;

}

 

int (*pfun)(int x, int y);

 

赋值:

Pfun=max

Pfun=&max

两个都可以

 

使用:

Pfun(a,b)

(* pfun)(a,b)

 

函数指针

标签:style   使用   sp   amp   on   new   c   as   bs   

原文地址:http://www.cnblogs.com/notlate/p/3947134.html

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