?- The number of variable arguments to a function??
Edouard Lagache
lagache at picsou.inria.fr
Fri Jun 29 20:49:47 AEST 1990
Hello World!
I have a tiny problem here which I'd appreciate a little help
with. I'd like to write a "C" function (actually C++, but same
difference), that takes a variable number of arguments (some sort
of data structure), and returns a continuous block of memory
containing those arguments in that order.
Looking at K&R, I see how I can get hold of the arguments, but not
how to find the number of arguments. Because in my case all the
arguments are of the same type (size), I could malloc (or New) the
right block size if I knew how many arguments were in the list.
Any thoughts? It occurred to me that I could just run through the
argument list twice, but I don't know if that can be done in an
implementation independant way.
Thanks in advance for the help!
Edouard Lagache
INRIA, Sophia Antipolis - FRANCE (for the summer)
P.S. Please reply to me directly, I'll post a summary if there is
interest.
More information about the Comp.lang.c
mailing list