How C function can have variable number of parameters?

This is a discussion on How C function can have variable number of parameters? within the C Programming forums, part of the General Programming Boards category; I read how this could be done before. But I could not remember where....

  1. #1
    Registered User
    Join Date
    Jul 2004
    Posts
    3

    How C function can have variable number of parameters?

    I read how this could be done before. But I could not
    remember where.

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    Search your reference for stdarg.h.
    My best code is written with the delete key.

  3. #3
    Registered User
    Join Date
    Jul 2004
    Posts
    3

    Thanks. This helps. How come most C books

    doesn't mention this?

  4. #4
    Registered User
    Join Date
    Jul 2003
    Posts
    59

  5. #5
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >How come most C books doesn't mention this?
    You have been reading the wrong books. Beginner books gloss over topics of an advanced nature, and this is one of those topics. Of course, functions with a variable number of arguments aren't nearly as useful as some would lead you to believe, so they are left out of many texts for that reason as well.
    My best code is written with the delete key.

  6. #6
    Registered User
    Join Date
    Jul 2004
    Posts
    3
    I went through more than a few books for this question before.

    I never need it in practice. Only met it in interview.

  7. #7
    Registered User Draco's Avatar
    Join Date
    Apr 2002
    Posts
    463

  8. #8
    ---
    Join Date
    May 2004
    Posts
    1,379
    couldnt you just use NULL as a parameter you dont need?

  9. #9
    Helper
    Join Date
    Jun 2004
    Posts
    255
    Quote Originally Posted by sand_man
    couldnt you just use NULL as a parameter you dont need?
    NULL will only work with pointers parameters.
    Emmanuel Delahaye

    "C is a sharp tool"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. doubt in c parser coding
    By akshara.sinha in forum C Programming
    Replies: 4
    Last Post: 12-23-2007, 12:49 PM
  3. Variable number of arguments in function.
    By kamoda_pawel in forum C Programming
    Replies: 1
    Last Post: 01-18-2007, 06:18 AM
  4. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-29-2005, 11:21 PM
  5. A function accepting a variable number of arguments.
    By Lithorien in forum C++ Programming
    Replies: 3
    Last Post: 10-10-2004, 01:48 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21