passing parameter list of one function to another

Discussion in 'C Programming' started by Neil Zanella, Nov 30, 2003.

  1. Neil Zanella

    Neil Zanella Guest

    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
     
    Neil Zanella, Nov 30, 2003
    #1
    1. Advertising

  2. Neil Zanella

    James Hu Guest

    On 2003-11-30, Neil Zanella <> 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
     
    James Hu, Nov 30, 2003
    #2
    1. Advertising

  3. Neil Zanella

    Ravi Uday Guest

    Neil Zanella <> wrote in message news:<>...
    > 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
     
    Ravi Uday, Dec 1, 2003
    #3
  4. 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"?
     
    Peter Shaggy Haywood, Dec 4, 2003
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?U3JpZGhhcg==?=

    passing Component One webGrid as parameter to a function

    =?Utf-8?B?U3JpZGhhcg==?=, Jan 4, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    474
    =?Utf-8?B?U3JpZGhhcg==?=
    Jan 4, 2006
  2. Newsgroup - Ann
    Replies:
    5
    Views:
    641
    John Carson
    Jul 30, 2003
  3. Mister B
    Replies:
    8
    Views:
    584
    Nick Keighley
    Aug 26, 2010
  4. Robert Cohen
    Replies:
    3
    Views:
    295
    Andrew Durstewitz
    Jul 15, 2003
  5. AzamSharp
    Replies:
    2
    Views:
    192
Loading...

Share This Page