带函数指针的typedef [英] typedef with function pointers

查看:85
本文介绍了带函数指针的typedef的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!!

任何人都可以清楚地解释下列符号的含义:


1. typedef char(*(* frpapfrc()) [])();

frpapfrc f;


2. typedef int(*(arr2d_ptr)())[3] [4];

arr2d_ptr p;


3. typedef int(*(*(* ptr2d_fptr)())[10])();

ptr2d_fptr q;


4. typedef char(*(* arr_fptr [3])())[10];

arr_fptr x;


5. typedef float *(*(*(* ptr_fptr)())[10])();

ptr_fptr y;


什么是f,p,q,x,y ??怎么样?

请不要只是清楚地回答他们的解释。

提前致谢...


Gaurav

解决方案

Googy写道:


>

任何人都可以清楚地解释下列符号的含义:


1. typedef char(*(* frpapfrc())[])(); < br $>
frpapfrc f;


2. typedef int(*(arr2d_ptr)())[3] [4];

arr2d_ptr p;


3. typedef int(*(*(* ptr2d_fptr)())[10])();

ptr2d_fptr q;


4. typedef char(*(* arr_fptr [3])())[10];

arr_fptr x;


5. typedef float *(*(*(* ptr_fptr)())[10])();

ptr_fptr y;


什么是F,p,q,X,Y ??如何?



它们是声明类型的对象。对于那种类型,请参阅

前面的typedef。


-

Chuck F(cinefalconer at maineline dot net)

可用于咨询/临时嵌入式和系统。

< http://cbfalconer.home.att.net>


-

通过 http:// www。中的免费Usenet帐户发布。 teranews.com


Googy写道:


嗨!!

任何人都可以清楚地解释下列符号的含义:


1. typedef char(*(* frpapfrc())[])();

frpapfrc f;


2. typedef int(*(arr2d_ptr)())[3] [4];

arr2d_ptr p ;


3. typedef int(*(*(* ptr2d_fptr)())[10])();

ptr2d_fptr q;


4. typedef char(*(* arr_fptr [3])())[10];

arr_fptr x;


5. typedef float *(*(*(* ptr_fptr)())[10 ])();

ptr_fptr y;


什么是f,p,q,x,y ??怎么样?

请不要只是清楚地回答他们的解释。



homework-o-meter = 100%


提示:cdecl


-

Tor< torust [at] online [dot] no>

到目前为止,许多C程序员都认为''强打字''只是意味着在键盘上敲击额外费用


9月30日下午1:52,Tor Rustad< tor_rus ... @ hotmail.comwrote:


Googy写道:


嗨!!

任何人都可以清楚地解释下列符号的含义:


1. typedef char(*(* frpapfrc())[])();

frpapfrc f;


2. typedef int(*(arr2d_ptr)())[3] [4];

arr2d_ptr p;


3. typedef int(*(*(* ptr2d_fptr)())[10])();

ptr2d_fptr q;


4. typedef char(*(* arr_fptr [3])())[10];

arr_fptr x ;


5. typedef float *(*(*(* ptr_fptr)())[10])();

ptr_fptr y;


什么是f,p,q,x,y ??怎么样?

请不要只是回答他们的解释然后清楚..



homework-o-meter = 100%


提示:cdecl



继承人很快问题:


一个典型的类似结构的数据类型的typedef如下:

typedef struct X {...} XStruct;


其中XStruct现在是 ; struct X。为什么我们不遵循类似的方式

定义函数指针?或者,这两种声明的类型

的位置遵循类似的规则吗?


-Vardhan

< blockquote class =post_quotes>
>

-

Tor< torust [at] online [dot] no>
$ b b到目前为止,许多C程序员都认为''强打字''只是意味着'b $ b b键在键盘上猛烈敲击'



Hi!!
Can any one explain me the meaning of following notations clearly :

1. typedef char(*(*frpapfrc())[])();
frpapfrc f;

2. typedef int (*(arr2d_ptr)())[3][4];
arr2d_ptr p;

3. typedef int (*(*(*ptr2d_fptr)())[10])();
ptr2d_fptr q;

4. typedef char (*(*arr_fptr[3])())[10];
arr_fptr x;

5. typedef float *(*(*(*ptr_fptr)())[10])();
ptr_fptr y;

What are f,p,q,x,y?? and how?
Please don''t just answer what they are explain then clearly..
Thanks in advance...

Gaurav

解决方案

Googy wrote:

>
Can any one explain me the meaning of following notations clearly :

1. typedef char(*(*frpapfrc())[])();
frpapfrc f;

2. typedef int (*(arr2d_ptr)())[3][4];
arr2d_ptr p;

3. typedef int (*(*(*ptr2d_fptr)())[10])();
ptr2d_fptr q;

4. typedef char (*(*arr_fptr[3])())[10];
arr_fptr x;

5. typedef float *(*(*(*ptr_fptr)())[10])();
ptr_fptr y;

What are f,p,q,x,y?? and how?

They are objects of the type declared. For what that type is, see
the preceding typedef.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>

--
Posted via a free Usenet account from http://www.teranews.com


Googy wrote:

Hi!!
Can any one explain me the meaning of following notations clearly :

1. typedef char(*(*frpapfrc())[])();
frpapfrc f;

2. typedef int (*(arr2d_ptr)())[3][4];
arr2d_ptr p;

3. typedef int (*(*(*ptr2d_fptr)())[10])();
ptr2d_fptr q;

4. typedef char (*(*arr_fptr[3])())[10];
arr_fptr x;

5. typedef float *(*(*(*ptr_fptr)())[10])();
ptr_fptr y;

What are f,p,q,x,y?? and how?
Please don''t just answer what they are explain then clearly..

homework-o-meter = 100%

Hint: cdecl

--
Tor <torust [at] online [dot] no>
"To this day, many C programmers believe that ''strong typing'' just means
pounding extra hard on the keyboard"


On Sep 30, 1:52 pm, Tor Rustad <tor_rus...@hotmail.comwrote:

Googy wrote:

Hi!!
Can any one explain me the meaning of following notations clearly :

1. typedef char(*(*frpapfrc())[])();
frpapfrc f;

2. typedef int (*(arr2d_ptr)())[3][4];
arr2d_ptr p;

3. typedef int (*(*(*ptr2d_fptr)())[10])();
ptr2d_fptr q;

4. typedef char (*(*arr_fptr[3])())[10];
arr_fptr x;

5. typedef float *(*(*(*ptr_fptr)())[10])();
ptr_fptr y;

What are f,p,q,x,y?? and how?
Please don''t just answer what they are explain then clearly..


homework-o-meter = 100%

Hint: cdecl

Heres are quick question:

A typical typedef for a data type like a struct goes like:

typedef struct X { ...} XStruct;

where XStruct is now "struct X". Why don''t we follow a similar way to
define function pointers? Or is it that the placement of the type
defined follows a similar rule for both these declarations?

-Vardhan

>
--
Tor <torust [at] online [dot] no>
"To this day, many C programmers believe that ''strong typing'' just means
pounding extra hard on the keyboard"



这篇关于带函数指针的typedef的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆