By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,898 Members | 2,039 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,898 IT Pros & Developers. It's quick & easy.

array of functions

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

Dec 15 '05 #1
Share this Question
Share on Google+
10 Replies


P: n/a
"raghu" writes:
wats the declaration for array of functions with int parameters?wats
the prototype of printf?
thanx a lot


thereaintnun luk at anbook urwelcum
Dec 15 '05 #2

P: n/a
"raghu" <ra*********@gmail.com> writes:
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, ...);

--
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.
Dec 15 '05 #3

P: n/a
raghu wrote:
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/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
Dec 15 '05 #4

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

Dec 16 '05 #5

P: n/a
"raghu" <ra*********@gmail.com> writes:
i'm sorry if i had hurt you Mr. Thompson and Mr.Rob.But thanks a lot
for your valuable responses.


Constructive criticism doesn't mean I'm hurt; it's just advice.

Spaces between sentences are also helpful.

And please read <http://cfaj.freeshell.org/google/>.

--
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.
Dec 16 '05 #6

P: n/a
raghu wrote:
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/>
Dec 16 '05 #7

P: n/a
In article <QO******************************@maineline.net> ,
Chuck F. <cb********@maineline.net> wrote:
raghu wrote:
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.


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).

Dec 16 '05 #8

P: n/a
On 2005-12-16, Kenny McCormack <ga*****@yin.interaccess.com> wrote:
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.]
Dec 16 '05 #9

P: n/a
Jordan Abel <jm****@purdue.edu> writes:
On 2005-12-16, Kenny McCormack <ga*****@yin.interaccess.com> wrote: [the usual]

[snip]

Please don't feed the troll.

--
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.
Dec 16 '05 #10

P: n/a
Jordan Abel wrote:
On 2005-12-16, Kenny McCormack <ga*****@yin.interaccess.com> wrote:
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)
Dec 16 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.