Help with varargs

Shiping Zhang ping at cubmol.bio.columbia.edu
Wed Mar 14 00:46:07 AEST 1990


In article <136 at caslon.cs.arizona.edu> dave at cs.arizona.edu (David P. Schaumann) writes:
>I want to write a routine that uses variable number of args that passes
>*all* of it's args to another routine.  I tried this:
>
>	int s( size, va_alist )
>	int size ;
>	va_dcl
        ^^^^^^
This is the trick point.  I guess the types of your args are also varied
at different calls to this routine.  If I'm right, then you need using
union to deal with this problem. Just define an union with all possible
used data types in it. Then declare an array of this union, and put your
args in this array and use it as the args list.

 
-ping



More information about the Comp.lang.c mailing list