Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!mcsun!news.funet.fi!hydra!klaava!wirzeniu From: wirzeniu@klaava.Helsinki.FI (Lars Wirzenius) Newsgroups: comp.lang.c Subject: Re: Prototyping Question Keywords: Prototype Message-ID: <1991Jun15.082039.16139@klaava.Helsinki.FI> Date: 15 Jun 91 08:20:39 GMT References: <1991Jun14.122200.3710@socrates.umd.edu> Organization: University of Helsinki Lines: 22 In article <1991Jun14.122200.3710@socrates.umd.edu> cm315a@socrates.umd.edu (cmis 315 section 4011) writes: >Here's a question on prototyping that has me (and the compiler) >baffled. I have a function that takes one, or more parameters. If I >decalre it as: void funct(char *, ... ) the calls to it with one or two >(or more) parameters passes without errors, but when the compiler >comes to the function itself, I get an error - not enough parameters. How is the function defined? It should be defined as void funct(char *first, ...) { va_list args; /* and any other local variables */ va_start(args, first); /* access all arguments after first in a strictly sequental order using va_arg(args). */ va_end(args); } Hope this helps. -- Lars Wirzenius wirzeniu@cc.helsinki.fi