社区
C语言
帖子详情
typedef *(*(*fun)(int))[5];
flybusflybus
2003-08-20 09:10:23
大家说说他的原型
typedef (*(*fun)(int));这个是int* test(int)函数指针类型
标题那个呢?
...全文
144
5
打赏
收藏
typedef *(*(*fun)(int))[5];
大家说说他的原型 typedef (*(*fun)(int));这个是int* test(int)函数指针类型 标题那个呢?
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
5 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
aflyinghorse
2003-08-20
打赏
举报
回复
以下编译通过
typedef int*(*(*fun)(int))[5];
typedef int* (*PA)[5];
PA test(int){};
fun f=&test;
point_to
2003-08-20
打赏
举报
回复
给一个好东东: :)
http://expert.csdn.net/Expert/topic/1319/1319172.xml?temp=.2153894
point_to
2003-08-20
打赏
举报
回复
typedef *(*(*fun)(int))[5];
*fun fun是一个指针
(*fun)(int) fun是一个函数指针,函数的参数为一个int
*(*fun)(int) 函数返回的还是一个指针
(*(*fun)(int))[5] 返回的指针指向有五个元素的数组
*(*(*fun)(int))[5] 数组的每个元素都是指针
flybusflybus
2003-08-20
打赏
举报
回复
申明一个这样的函数看看哦
aflyinghorse
2003-08-20
打赏
举报
回复
标题是int* test(int)函数指针类型
返回值是int* (*)[5],即数组指针,该数组
有5个元素,类型为int *
《C经典面试》编译链接、指针、内存bug、函数、其它
课程内容:1.编译链接:编译链接过程、预编译、存储类、生命周期、作用域、链接域等2.指针:指针概念、数组相关的指针、字符串指针、函数指针等3.内存bug:内存越位、内存覆盖、使用非法内存、内存泄露等。4.函数:自定义函数、内联函数、回调函数、变参函数、递归函数、库函数等5.其它:自动类型转换、数据溢出、结构体对齐、volatile、
typedef
、assert宏、逗号表达式、++/--等
typedef
int
()(
int
,
int
)
typedef
int
(*f)(
int
,
int
) 和
typedef
int
*f(
int
,
int
) 从函数声明说起
int
f(
int
,
int
);或者
int
*f(
int
,
int
); 前者声明一个具有其特征的函数,后者声明了一个具有其特征的指针函数。 例: #include "stdio.h" //因为自定义的函数在main函数之后,所以在使用自定义函数之前 //需要声明自定义函数 //所以有函数声明:
int
add(
int
,
int
);
int
*
fun
(
int
*,
int
*);
int
main()
typedef
的用法之
typedef
int
(*
fun
c)(
int
,
int
)
原文地址:http://blog.csdn.net/baoendemao/article/details/41209697 原文地址:http://www.educity.cn/wenda/295697.html
typedef
int
(
FUN
C1)(
int
in);
typedef
int
(
FUN
C2)(
int
*,
int
*,
int
*); 上面的语句作用是 作一个函数声明
typedef
int
(*
fun
c)(
int
,
int
)
先看一下例子: #include "iostream" using namespace std;
int
add(
int
a,
int
b){ return (a+b); }
typedef
int
(*
fun
c)(
int
,
int
) ; void main(){
fun
c f = add;
int
n = f(1,2); cout }
typedef
void* (*
fun
)(void)讲解
typedef
用来声明一个别名,
typedef
后面的语法,是一个声明。本来笔者以为这里不会产生什么误解的,但结果却出乎意料,产生误解的人不在少数。罪魁祸首又是那些害人的教材。在这些教材中介绍
typedef
的时候通常会写出如下形式:
typedef
int
PARA; 这种形式跟#define
int
PARA几乎一样,如前面几章所述,这些教材的宗旨是由浅入深,但实际做出来的行为却是以偏盖全。的确,这种形式在所有形式中是最简单的,但却没有对
typedef
进一步解释,使得不少人用...
C语言
69,371
社区成员
243,082
社区内容
发帖
与我相关
我的任务
C语言
C语言相关问题讨论
复制链接
扫一扫
分享
社区描述
C语言相关问题讨论
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章