Thread: Question about variable no. of args

  1. #1
    Registered User
    Join Date
    Jul 2005
    Posts
    23

    Question about variable no. of args

    I keep running across tutorials on how to make a function take a variable number of arguments as in myFunction(Arg1,...), where it will take any number of Arg1s. However, I have a function where it would be *!SUPER!*(can't stress how much so) handy to be able to do (Arg1,Arg2,...) where it would take, say, Arg1,Arg2,Arg1,Arg2,Arg1,Arg2 and act on each set. Is this doable?

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >Is this doable?
    I don't see why not, but variable length argument lists are to be avoided because they have subtle issues, and a vector is generally easier to work with.
    My best code is written with the delete key.

  3. #3
    Registered User
    Join Date
    Jul 2005
    Posts
    23

    Ahh

    A Vector eh.... *Googles like mad*

  4. #4
    Banned
    Join Date
    Jun 2005
    Posts
    594
    vectors are .............................. uh uh

    i love vectors.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Preprocessor trick for variable number of args
    By Jaken Veina in forum C Programming
    Replies: 3
    Last Post: 11-04-2008, 10:24 AM
  2. Replies: 9
    Last Post: 06-09-2008, 09:53 AM
  3. newb question: dynamic variable names
    By Dash_Riprock in forum C++ Programming
    Replies: 6
    Last Post: 07-17-2006, 10:48 AM
  4. Variable Arguments Question
    By moonwalker in forum C Programming
    Replies: 8
    Last Post: 08-04-2002, 09:08 AM
  5. Need help
    By awkeller in forum C Programming
    Replies: 2
    Last Post: 12-09-2001, 03:02 PM