Thread: counting # of args sending into a function...

  1. #1
    A Banana Yoshi's Avatar
    Join Date
    Oct 2001
    Posts
    859

    counting # of args sending into a function...

    how to do with stdarg? va

  2. #2
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,138
    int main(int argc, char* argv[])

    There are argc parameters (including the name of the prog). They range from 0 to argc-1 in char* argv[].

  3. #3
    I lurk
    Join Date
    Aug 2002
    Posts
    1,361

    Re: counting # of args sending into a function...

    Originally posted by Wraith_Master
    how to do with stdarg? va
    There's no way.
    Either predefine an argument which signals the end of the list, have the first argument set to the number of arguments you're passing or do something similar to the printf family of functions.

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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 05-13-2011, 08:28 AM
  2. doubt in c parser coding
    By akshara.sinha in forum C Programming
    Replies: 4
    Last Post: 12-23-2007, 01:49 PM
  3. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  4. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  5. Replies: 5
    Last Post: 02-08-2003, 07:42 PM