Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!cs.utexas.edu!rutgers!columbia!cubmol!ping From: ping@cubmol.bio.columbia.edu (Shiping Zhang) Newsgroups: comp.lang.c Subject: Re: Help with varargs Message-ID: <1990Mar13.144607.20934@cubmol.bio.columbia.edu> Date: 13 Mar 90 14:46:07 GMT References: <136@caslon.cs.arizona.edu> Reply-To: ping@cubmol.bio.columbia.edu (Shiping Zhang) Distribution: usa Organization: Dept. of Biology, Columbia Univ., New York, NY Lines: 16 In article <136@caslon.cs.arizona.edu> dave@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