Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > passing parameter list of one function to another

Reply
Thread Tools

passing parameter list of one function to another

 
 
Neil Zanella
Guest
Posts: n/a
 
      11-30-2003

Hello,

Consider the following function prototype:

foo(int, ...);

Inside the body of function foo I want to call another function whose
signature is given as follows:

bar(int, ...);

No matter how many parameters are passed to foo, I want bar to be called
with the exact same parameter list. Is it possible to do this?

Thanks,

Neil

 
Reply With Quote
 
 
 
 
James Hu
Guest
Posts: n/a
 
      11-30-2003
On 2003-11-30, Neil Zanella <(E-Mail Removed)> wrote:
> Consider the following function prototype:
>
> foo(int, ...);
>
> Inside the body of function foo I want to call another function whose
> signature is given as follows:
>
> bar(int, ...);
>
> No matter how many parameters are passed to foo, I want bar to be called
> with the exact same parameter list. Is it possible to do this?


This is a comp.lang.c FAQ. Please refer to the answer to question
15.12 of the C-faq.

http://www.eskimo.com/~scs/C-faq/top.html

-- James
 
Reply With Quote
 
 
 
 
Ravi Uday
Guest
Posts: n/a
 
      12-01-2003
Neil Zanella <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> Hello,
>
> Consider the following function prototype:
>
> foo(int, ...);
>
> Inside the body of function foo I want to call another function whose
> signature is given as follows:
>
> bar(int, ...);
>
> No matter how many parameters are passed to foo, I want bar to be called
> with the exact same parameter list. Is it possible to do this?
>


You may need to look at variable-argument list functions
va_arg, va_end, va_start, vsprintf etc..

- Ravi
 
Reply With Quote
 
Peter Shaggy Haywood
Guest
Posts: n/a
 
      12-04-2003
Groovy hepcat Neil Zanella was jivin' on Sat, 29 Nov 2003 23:58:21
-0330 in comp.lang.c.
passing parameter list of one function to another's a cool scene! Dig
it!

>Consider the following function prototype:
>
>foo(int, ...);
>
>Inside the body of function foo I want to call another function whose
>signature is given as follows:
>
>bar(int, ...);
>
>No matter how many parameters are passed to foo, I want bar to be called
>with the exact same parameter list. Is it possible to do this?


This has been answered here more than once recently. It is also in
the FAQ. The fact that you are asking this question indicates that you
have not a) read the FAQ or b) lurked in the newsgroup for any length
of time, both of which you should have done before posting. This is
very rude, not to mention a waste of bandwidth (which forces the cost
of Net access up - and I'm sick of paying for people who keep asking
the same questions all the time!). Stop doing that! Lurk for at least
a month. Read the FAQ (http://www.eskimo.com/~scs/C-faq/top.html).
Please do not post again until you have done so.

--

Dig the even newer still, yet more improved, sig!

http://alphalink.com.au/~phaywood/
"Ain't I'm a dog?" - Ronny Self, Ain't I'm a Dog, written by G. Sherry & W. Walker.
I know it's not "technically correct" English; but since when was rock & roll "technically correct"?
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Passing parameter to function not expecting parameter Mister B C Programming 8 08-26-2010 08:01 AM
How to pass a parameter for a function parameter in a function AzamSharp Javascript 2 07-05-2008 12:24 AM
write a function such that when ever i call this function in some other function .it should give me tha data type and value of calling function parameter komal C++ 6 01-25-2005 11:13 AM
Passing a pointer to member function as a parameter to another member function Newsgroup - Ann C++ 5 07-30-2003 02:54 AM
Passing value from one script on one page to another script on another page. Robert Cohen ASP General 3 07-15-2003 01:46 PM



Advertisments