一系列功能 [英] array of functions

查看:75
本文介绍了一系列功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用int参数查看函数数组的声明?wats

printf的原型?

thanx很多

wats the declaration for array of functions with int parameters?wats
the prototype of printf?
thanx a lot

推荐答案

" raghu"写道:
"raghu" writes:
使用int参数查看函数数组的声明?wats
printf的原型?
thanx很多
wats the declaration for array of functions with int parameters?wats
the prototype of printf?
thanx a lot




thereaintnun luk at anbook urwelcum



thereaintnun luk at anbook urwelcum


" raghu" < RA ********* @ gmail.com>写道:
"raghu" <ra*********@gmail.com> writes:
使用int参数的函数数组的声明?
wats the printf的原型?
wats the declaration for array of functions with int parameters?
wats the prototype of printf?




请带是时候写正确的英语了。如果它不是你的母语

语言,我们肯定会有津贴,但是有些努力会是赞赏的。


没有函数数组这样的东西。你在寻找

一系列函数指针吗?


printf()的原型应该在你的文档中。在C99,

它是


int printf(const char * restrict format,...);


-

Keith Thompson(The_Other_Keith) ks***@mib.org < http ://www.ghoti.net/~kst>

圣地亚哥超级计算机中心< *> < http://users.sdsc.edu/~kst>

我们必须做点什么。这是事情。因此,我们必须这样做。



Please take the time to write proper English. If it''s not your native
language we''ll certainly make allowances, but some effort would be
appreciated.

There''s no such thing as an array of functions. Are you looking for
an array of pointers to functions?

The prototype of printf() should be in your documentation. In C99,
it''s

int printf(const char * restrict format, ...);

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.


raghu写道:
使用int参数查看函数数组的声明?wats
printf的原型?
thanx很多
wats the declaration for array of functions with int parameters?wats
the prototype of printf?
thanx a lot




您好,Raghu。


我发现拼写正确,语法和标点符号经常

防止误解。我强烈建议您避免缩写,例如

" wats"和/

要声明*指向*函数的*指针数组,只需要一个int,并且

返回void,请执行以下操作:

void a(int);

void b(int);

void(* array_of_poitner_to_func [])(int)= {a,b };


顺便说一下,我使用了cdecl。和gcc -Wall -pedantic -ansi程序

帮我回答你的问题。如果你有权访问它们,那么每个它们都是一个很好的资源。


你永远不必在你的程序中指定printf的原型。实际上,你必须永远不要在你的程序中指定printf'的原型。 (这个
限制可能在技术上是不正确的。我相信有人会纠正

我。)总是提供以下行:

#在任何调用printf()的程序中包含< stdio.h>

。话虽如此,printf的

原型是其中之一,具体取决于您使用的C版本:

int printf(const char * restrict format ,. ..); / * C99 * /

int printf(const char * format,...); / * C90 * /


我在公开的*草案* C99标准中找到了这些信息


http://www.open-std .org / jtc1 / sc22 / wg ... 69 / n869.txt.gz


请注意,此草案与最终发布的标准不同。


最后,请阅读此新闻组的常见问题解答。您可以通过

指定comp.lang.c常见问题解答找到它。在 www.google.com


我希望这会有所帮助。


Rob



Hello, Raghu.

I have found that correct spelling, grammar and punctuation often
prevent misunderstandings. I urge you to avoid abbreviations such as
"wats" and "thanx".

To declare an array of *pointers to* functions taking a single int and
returning void, do something like this:
void a(int);
void b(int);
void (*array_of_poitner_to_func[])(int ) = { a, b };

By the way, I used the "cdecl" and "gcc -Wall -pedantic -ansi" programs
to help me answer your question. If you have access to them, each of
them is a great resource.

You should never have to specify printf''s prototype in your program. In
fact, you must never specify printf''s prototype in your program. (This
restriction may be technically incorrect. I''m sure someone will correct
me.) Always provide the following line:
#include <stdio.h>
in any program that invokes printf(). Having said that, printf''s
prototype is one of these, depending upon which version of C you are using:
int printf(const char * restrict format, ...); /* C99 */
int printf(const char * format, ...); /* C90 */

I found this information in the publicly-available *draft* C99 standard
here:
http://www.open-std.org/jtc1/sc22/wg...69/n869.txt.gz

Note that this draft varies somewhere from the final, published standard.

Finally, please read the FAQ for this newsgroup. You can find it by
specifying "comp.lang.c FAQ" at www.google.com.

I hope this helps.

Rob


这篇关于一系列功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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