Name of this function?

This is a discussion on Name of this function? within the C++ Programming forums, part of the General Programming Boards category; Hey, I know there is a function that can except X number of arguments and add up the sum of ...

  1. #1
    Registered User
    Join Date
    Sep 2002
    Posts
    70

    Name of this function?

    Hey, I know there is a function that can except X number of arguments and add up the sum of them...similar to the way printf works, only it can take integers. Does anybody know the name of this function, and how in the world you use it. I remember reading a tutorial somewhere before...it had something to do with a protocal like this.
    Code:
    void function(int number, ...);
    and then you had to do a whole bunch of other stuff..which i can't remember what other stuff. Actually now that I think about it, this function only allows you to accept X number of arguments, you can just add them all up.

  2. #2
    Registered User
    Join Date
    Jan 2003
    Posts
    311
    There is no such standard function. The stl provides accumulate in the numeric header, but this works for itterator pairs (vectors, arrays, etc..)

  3. #3
    Registered User
    Join Date
    Sep 2002
    Posts
    70
    i don't wanna sound like i know what i'm talking about...but i am almost certain there is such a technique...

  4. #4
    Me -=SoKrA=-'s Avatar
    Join Date
    Oct 2002
    Location
    Europe
    Posts
    448

    uh?

    COMPLETE EDIT:
    http://www.cprogramming.com/tutorial/lesson17.html
    should give you all the information you need on variable arguments list functions.
    You should look at the tutorial before posting a question. You'll probably have to #include <cstdarg> instead of <stdarg.h>
    Last edited by -=SoKrA=-; 04-19-2003 at 11:11 AM.
    SoKrA-BTS "Judge not the program I made, but the one I've yet to code"
    I say what I say, I mean what I mean.
    IDE: emacs + make + gcc and proud of it.

  5. #5
    Registered User
    Join Date
    Sep 2002
    Posts
    70
    I did take a look quick actually, must have missed it. sorry.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiling sample DarkGDK Program
    By Phyxashun in forum Game Programming
    Replies: 6
    Last Post: 01-27-2009, 02:07 AM
  2. Seg Fault in Compare Function
    By tytelizgal in forum C Programming
    Replies: 1
    Last Post: 10-25-2008, 03:06 PM
  3. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  4. Replies: 28
    Last Post: 07-16-2006, 11:35 PM
  5. const at the end of a sub routine?
    By Kleid-0 in forum C++ Programming
    Replies: 14
    Last Post: 10-23-2005, 06:44 PM

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