1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Dynamic Function Parameters

Discussion in 'C' started by kanaks_go4ex, Aug 26, 2008.

  1. kanaks_go4ex

    kanaks_go4ex New Member

    Joined:
    Jun 11, 2008
    Messages:
    16
    Likes Received:
    0
    Trophy Points:
    0
    Hi all,

    I'm little confused.

    Is it possible to choose number of arguments 'n' for the function "F" in run time?
    Function 'F' ('n ')

    If possible,how do we declare the prototype for this Function 'F' ?

    thanks
     
  2. oogabooga

    oogabooga New Member

    Joined:
    Jan 9, 2008
    Messages:
    115
    Likes Received:
    11
    Trophy Points:
    0
    Look up "variable length argument lists".

    "printf" uses a variable number of arguments.
    Code:
    printf("hi");
    printf("%d %d", 1, 2);
    The prototype for printf is
    Code:
    int printf(const char *format, ...);
     
  3. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,292
    Likes Received:
    365
    Trophy Points:
    83

Share This Page