Grabbing "n" arguments in a function

uma at slug..austin.ibm.com uma at slug..austin.ibm.com
Tue May 1 22:57:55 AEST 1990


In article <744 at tmiuv0.uucp> rick at tmiuv0.uucp writes:
>Ok, I know this may be a stupid question, but I'll brave the arrows and
>missiles hurled in my direction...
>
>What's the most portable way for a function to receive an arbitrary list of
>arguments?  The function must receive "n" arguments, all of which are char.
>pointers:
>

I think the most portable way to achieve this is to use "varargs" feature
as provided by the libc.a(on UNIX, I don't know about other OS). See
/usr/include/varargs.h on UNIX System V any release. and also
K&R C book describes how to use it too( 2nd edition of K&R C book pages 
155-159).

>  .-------------------------------------------------------------------------.
> / [- O] Rick Stevens (All opinions are mine. Everyone ignores them anyway.) \
>|    ?   +--------------------------------------------------------------------|
>|    V   | uunet!zardoz!tmiuv0!rick             (<-- Work (ugh!))             |
>|--------+ uunet!zardoz!xyclone!sysop           (<-- Home Unix (better!))     |
>|  uunet!perigrine!ccicpg!conexch!amoeba2!rps2  (<-- Home Amiga (Best!!)      |
> \ 75006.1355 at compuserve.com (CIS: 75006,1355)  (<-- CI$)                    /
>  `-------------------------------------------------------------------------'
>"A day without sunshine is like..............night!"

===============================================================================
Uma S. Pandey (contractor at IBM)     	Disc:  "Any opinions are mine"
Internal:uma at slug.austin.ibm.com   VNET: sc10333 at ausvmq  
External: uunet!cs.utexas.edu!ibmaus!auschs!slug.austin.ibm.com!uma
===============================================================================
===============================================================================
Uma S. Pandey (contractor at IBM)     	Disc:  "Any opinions are mine"
Internal:uma at slug.austin.ibm.com   VNET: sc10333 at ausvmq  T/L 793-4078.
External: uunet!cs.utexas.edu!ibmaus!auschs!slug.austin.ibm.com!uma



More information about the Comp.lang.c mailing list