Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!ncrlnk!wright!thor.wright.edu From: econrad@thor.wright.edu (Eric Conrad) Newsgroups: comp.lang.c Subject: Re: Variable Parameters Message-ID: <897@thor.wright.EDU> Date: 2 Jan 90 21:05:15 GMT References: <1169@zip.eecs.umich.edu> Sender: news@wright.EDU Reply-To: econrad@thor.wright.edu Lines: 22 From article <1169@zip.eecs.umich.edu>, by bagchi@dip.eecs.umich.edu (Ranjan Bagchi): > > I'm working, currently, on a project that involves a function that > could take any number or arguments. I would like to pass it only > those arguments, i.e. no "flags" at the end which tell the function > to stop. If I understand the ANSI C mechanism, which uses varargs.h, you have to pass either some indication of the number of parameters or a sentinel parameter. I used this method once several months ago and found it a bit cumbersome. An alternative is to write a stack handling module and use it to push and pop parameters. The pop function could then return an stack empty status. The additional source code would be on the push side. -- Eric Conrad +----------------------------------------------------------+ | Eric Conrad - Wright State University | | "Progress was all right once, but it went on too long." | +----------------------------------------------------------+