Prototyping Question

Lars Wirzenius wirzeniu at klaava.Helsinki.FI
Sat Jun 15 18:20:39 AEST 1991


In article <1991Jun14.122200.3710 at socrates.umd.edu> cm315a at 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 at cc.helsinki.fi



More information about the Comp.lang.c mailing list