varargs

Doug Gwyn gwyn at smoke.brl.mil
Fri Feb 8 06:19:50 AEST 1991


In article <1428 at tau.sm.luth.se> d90-pan at sm.luth.se (Per Andersson) writes:
>I have a big problem using the varargs library.

True.

>What I want to do is to write a function that takes a variable number of
>arguments and simply passes them on to another function like this:
>	a_func( va_alist )
>	va_dcl
>	{
>		b_func( va_alist );
>	};

	a_func( va_alist )
		va_dcl
		{
		va_list	ap;
		va_start( ap );
		b_func( ap );
		va_end( ap );
		}

	b_func( ap )
		va_list ap;
		{
		char *fmt = va_arg( ap, char * );
		...
		}



More information about the Comp.lang.c mailing list