array of functions

R

raghu

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

Keith Thompson

raghu said:
wats the declaration for array of functions with int parameters?
wats the prototype of printf?

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, ...);
 
R

Rob Adams

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

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/wg14/www/docs/n869/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
 
R

raghu

i'm sorry if i had hurt you Mr. Thompson and Mr.Rob.But thanks a lot
for your valuable responses.
 
C

Chuck F.

raghu said:
i'm sorry if i had hurt you Mr. Thompson and Mr.Rob.But thanks a lot
for your valuable responses.
I doubt they are seriously hurt. However, you should include
context in order to make any sense. See sig. below.

--
"If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers." - Keith Thompson
More details at: <http://cfaj.freeshell.org/google/>
 
K

Kenny McCormack

I doubt they are seriously hurt. However, you should include
context in order to make any sense. See sig. below.

You (and others, such as Keith) are wasting your breath. They'll never get
it. And I'll tell you why.

Imagine that there's a mouse - and the mouse is the Usenet. You and I can
see that it is a mouse and we behave accordingly. But now there is a class
of users (we'll call them "googlers") that are wearing these funny weird
glasses that make them see not a mouse, but an elephant. Seeing an
elephant (i.e., the Usenet as a web page), they also behave accordingly.
And no amount of verbiage from us is going to convince them that it's not
an elephant - that it is only a mouse.

To make this more clear, to a googler, it doesn't make any sense to "quote"
(whatever the heck that is...), in fact, to do so would be absurd, when all
the rest of the articles in the thread are right there in front of their
faces (just as clear as the trunk on that mouse, er, elephant). And no
amount of verbiage from us is going to convince them not to believe what
they see. The point is you can *never* convince someone that what they see
isn't reality. The only way you can address the problem is to help them
fix their eyesight (or help them remove their funny glasses).
 
J

Jordan Abel

To make this more clear, to a googler, it doesn't make any sense to
"quote" (whatever the heck that is...), in fact, to do so would be
absurd, when all the rest of the articles in the thread are right
there in front of their faces (just as clear as the trunk on that
mouse, er, elephant).

Given that quoting is equally customary on web forums on such interfaces
as invision, ubb, phpbb, and so on, i think it's more likely the fact
that the reply button doesn't quote, then any fundamental problem with
the idea of quoting.

That's to say nothing of such places as slashdot or fark, where people
will actually go to the trouble of quoting text by hand [which I think
is an oddity particularly on slashdot, which is the only of _any_ of the
interfaces mentioned, google included, which does not use a flat
interface by default. Perhaps it's an artifact of the high proportion of
technically literate users, who may have used usenet before.]
 
C

Chuck F.

Jordan said:
On 2005-12-16 said:
To make this more clear, to a googler, it doesn't make any sense to
"quote" (whatever the heck that is...), in fact, to do so would be
absurd, when all the rest of the articles in the thread are right
there in front of their faces (just as clear as the trunk on that
mouse, er, elephant).

Given that quoting is equally customary on web forums on such interfaces
as invision, ubb, phpbb, and so on, i think it's more likely the fact
that the reply button doesn't quote, then any fundamental problem with
the idea of quoting.

That's to say nothing of such places as slashdot or fark, where people
will actually go to the trouble of quoting text by hand [which I think
is an oddity particularly on slashdot, which is the only of _any_ of the
interfaces mentioned, google included, which does not use a flat
interface by default. Perhaps it's an artifact of the high proportion of
technically literate users, who may have used usenet before.]

+-------------------+ .:\:\:/:/:.
| PLEASE DO NOT | :.:\:\:/:/:.:
| FEED THE TROLLS | :=.' - - '.=:
| | '=(\ 9 9 /)='
| Thank you, | ( (_) )
| Management | /`-vvv-'\
+-------------------+ / \
| | @@@ / /|,,,,,|\ \
| | @@@ /_// /^\ \\_\
@x@@x@ | | |/ WW( ( ) )WW
\||||/ | | \| __\,,\ /,,/__
\||/ | | | jgs (______Y______)
/\/\/\/\/\/\/\/\//\/\\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
==============================================================

--
Some useful references about C:
<http://www.ungerhu.com/jxh/clc.welcome.txt>
<http://www.eskimo.com/~scs/C-faq/top.html>
<http://benpfaff.org/writings/clc/off-topic.html>
<http://anubis.dkuug.dk/jtc1/sc22/wg14/www/docs/n869/> (C99)
<http://www.dinkumware.com/refxc.html> (C-library}
<http://gcc.gnu.org/onlinedocs/> (GNU docs)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,172
Messages
2,570,934
Members
47,473
Latest member
ChristelPe

Latest Threads

Top