找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 277|回复: 1

Question1.17:What does typedef int (*funcptr)();mean?

[复制链接]

210

主题

371

回帖

0

积分

管理员

积分
0
发表于 2013-7-13 20:47:42 | 显示全部楼层 |阅读模式

Q: What does
            typedef int (*funcptr)();mean?
A: It defines a typedef, funcptr, for a pointer to a function (taking unspecified arguments) returning an int. It can be used to declare one or more pointers to functions:
                    funcptr pf1, pf2;
which is equivalent to the more verbose, and perhaps harder to understand
                    int (*pf1)(), (*pf2)();
See also questions 1.21, 4.12, and 15.11.

210

主题

371

回帖

0

积分

管理员

积分
0
 楼主| 发表于 2013-7-13 20:58:53 | 显示全部楼层
问题:这个是什么意思?
        typedef int (*funcptr)();
回答:它定义了一个类型funcptr。一个指向一个返回值为int型的函数(没有说明参数)的指针。它可以用来声明一个或者多个指向函数的指针:
          funcptr  pf1,pf2;
这个是与下面更加繁琐和不易理解的声明是等价的:
          int (*pf1)(),(*pf2)();
参考问题1.21、4.12和15.11。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

果子博客
扫码关注微信公众号

Archiver|手机版|小黑屋|风叶林

GMT+8, 2026-2-1 04:42 , Processed in 0.134925 second(s), 20 queries .

Powered by 风叶林

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表