how to use va_list

Discussion in 'C Programming' started by shiva, Feb 21, 2005.

  1. shiva

    shiva Guest

    i want to write a pgm which can take any number of integers(using
    va_list,... operator).

    but i am not able to find the end of integers, can any body help me
    out.
    shiva
    shiva, Feb 21, 2005
    #1
    1. Advertising

  2. shiva

    Michael Guest

    Hi,

    I am far from being an expert in C so please
    correct me if am wrong, but
    in the FAQ 15.8 states that there no way to do
    this. So I guess you have to pass this information
    as the first parameter.

    regards,
    michael
    Michael, Feb 21, 2005
    #2
    1. Advertising

  3. shiva

    Flash Gordon Guest

    Michael wrote:
    > I am far from being an expert in C so please
    > correct me if am wrong, but
    > in the FAQ 15.8 states that there no way to do
    > this. So I guess you have to pass this information
    > as the first parameter.


    You are correct that the C language does not provide any mechanism for
    detecting the end of a list of arguments. So, for the OP to write a
    function taking a list of integers without using a sentinel value, such
    as 0 or MIN_INT to indicate the end of the list, the only option is to
    pass the number of elements and it makes sense for this to be the first
    parameter.

    Please include enough context in your reply for people to see what you
    are replying to. Usenet does not guarantee that people receive messages
    in order and, even if they do, they might have read the message you are
    replying to a few weeks before they read your reply if they happen to go
    on holiday before seeing your reply. So without the context you reply
    will often make absolutely no sense.
    --
    Flash Gordon
    Living in interesting times.
    Although my email address says spam, it is real and I read it.
    Flash Gordon, Feb 21, 2005
    #3
  4. shiva

    Michael Mair Guest

    Flash Gordon wrote:
    > Michael wrote:
    >
    >> I am far from being an expert in C so please
    >> correct me if am wrong, but
    >> in the FAQ 15.8 states that there no way to do
    >> this. So I guess you have to pass this information
    >> as the first parameter.

    >
    >
    > You are correct that the C language does not provide any mechanism for
    > detecting the end of a list of arguments. So, for the OP to write a
    > function taking a list of integers without using a sentinel value, such
    > as 0 or MIN_INT to indicate the end of the list, the only option is to


    nit: INT_MIN

    > pass the number of elements and it makes sense for this to be the first
    > parameter.
    >
    > Please include enough context in your reply for people to see what you
    > are replying to. Usenet does not guarantee that people receive messages
    > in order and, even if they do, they might have read the message you are
    > replying to a few weeks before they read your reply if they happen to go
    > on holiday before seeing your reply. So without the context you reply
    > will often make absolutely no sense.



    --
    E-Mail: Mine is a gmx dot de address.
    Michael Mair, Feb 21, 2005
    #4
  5. shiva

    Michael Guest

    Hi Flash,

    Flash Gordon wrote:

    > Please include enough context in your reply for people to see what you
    > are replying to. Usenet does not guarantee that people receive messages
    > in order and, even if they do, they might have read the message you are
    > replying to a few weeks before they read your reply if they happen to go
    > on holiday before seeing your reply. So without the context you reply
    > will often make absolutely no sense.

    thanks for the information, I'll remember this next time
    and include enough of the old text to ensure the context.
    Sorry for breaking this rule.

    Regards,
    Michael
    Michael, Feb 21, 2005
    #5
  6. shiva

    CBFalconer Guest

    Michael wrote:
    > Flash Gordon wrote:
    >
    >> Please include enough context in your reply for people to see what
    >> you are replying to. Usenet does not guarantee that people receive
    >> messages in order and, even if they do, they might have read the
    >> message you are replying to a few weeks before they read your
    >> reply if they happen to go on holiday before seeing your reply. So
    >> without the context you reply will often make absolutely no sense.

    >
    > thanks for the information, I'll remember this next time
    > and include enough of the old text to ensure the context.
    > Sorry for breaking this rule.


    There is some worthwhile reading on the subject in the links below.

    --
    Some informative links:
    news:news.announce.newusers
    http://www.geocities.com/nnqweb/
    http://www.catb.org/~esr/faqs/smart-questions.html
    http://www.caliburn.nl/topposting.html
    http://www.netmeister.org/news/learn2quote.html
    CBFalconer, Feb 22, 2005
    #6
    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. va_list in JNI

    , Jun 23, 2005, in forum: Java
    Replies:
    4
    Views:
    2,328
  2. Rich Herrick

    reference to va_list

    Rich Herrick, Jan 16, 2005, in forum: C++
    Replies:
    0
    Views:
    433
    Rich Herrick
    Jan 16, 2005
  3. Peter

    va_list help, please ...

    Peter, Feb 15, 2005, in forum: C++
    Replies:
    6
    Views:
    3,547
    Pete Becker
    Feb 15, 2005
  4. John Guo

    va_list help

    John Guo, Mar 31, 2005, in forum: C++
    Replies:
    5
    Views:
    3,310
    Pete Becker
    Mar 31, 2005
  5. shiva

    how to use va_list

    shiva, Feb 21, 2005, in forum: C Programming
    Replies:
    3
    Views:
    1,507
    Christian Bau
    Feb 22, 2005
Loading...

Share This Page