How to use a function with variable number of arguments

Discussion in 'C Programming' started by EricLin, Feb 6, 2004.

  1. EricLin

    EricLin Guest

    Dear all:

    I am just concerned about how to use a function with variable number
    of arguments. for example:

    int TestFunction(arguments)
    {
    ....
    Testing contents...
    }

    The number of arguments will change every time I call TestFunction().

    Thanks.

    Yuncheng
    EricLin, Feb 6, 2004
    #1
    1. Advertising

  2. EricLin

    Ed Morton Guest

    EricLin wrote:
    > Dear all:
    >
    > I am just concerned about how to use a function with variable number
    > of arguments. for example:
    >
    > int TestFunction(arguments)
    > {
    > ...
    > Testing contents...
    > }
    >
    > The number of arguments will change every time I call TestFunction().
    >
    > Thanks.
    >
    > Yuncheng
    >


    Read the FAQ on variable length arguments:

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

    and the relevant chapter of your C book then come back if you have any
    questions.

    Ed>
    Ed Morton, Feb 6, 2004
    #2
    1. Advertising

  3. FAQ: How to use a function with variable number of arguments

    EricLin wrote:

    > I am just concerned about how to use a function
    > with variable number of arguments. for example:
    >
    > int TestFunction(arguments) {
    > ...
    > Testing contents...
    > }
    >
    > The number of arguments will change every time I call TestFunction().


    It's a Frequently Answered Question (FAQ)
    15. Variable-Length Argument Lists

    http://www.eskimo.com/~scs/C-faq/s15.html
    E. Robert Tisdale, Feb 6, 2004
    #3
    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. Alex
    Replies:
    1
    Views:
    372
    Ron Natalie
    Oct 16, 2003
  2. Vince
    Replies:
    3
    Views:
    381
    Victor Bazarov
    Nov 10, 2004
  3. jmborr
    Replies:
    1
    Views:
    412
    Stargaming
    Nov 3, 2007
  4. Replies:
    3
    Views:
    821
  5. Navaneeth
    Replies:
    4
    Views:
    550
    Kenny McCormack
    Nov 20, 2010
Loading...

Share This Page