variable number of strings passed to function - how?
Guy Harris
guy at auspex.UUCP
Mon Oct 24 07:16:10 AEST 1988
>In the C language arguments are placed on the stack in reverse order
>such that the first argument is the lowest index off of the stack pointer.
*AHEM* No, in certain *implementations* of the C language arguments are
placed onto the stack in reverse order....
In other implementations some of them are stuffed into registers.
The closest things to a portable way of doing a function taking a
variable number of arguments are:
1) "varargs" - present on many (most?) UNIX systems' C
implementations, and possibly on other implementations as
well (see VARARGS(n), for some value of "n", in the UNIX
documentation; if you don't have UNIX, look somewhere else).
2) "stdargs" - specified by ANSI C, so probably present in many
microcomputer implementations.
More information about the Comp.lang.c
mailing list