Varargs, portability
Mark Patrick
markl at vecpyr.UUCP
Sat May 10 08:55:04 AEST 1986
Is the following program portable to any machine which provides a
(reasonable) implementation of C.
#include <varargs.h>
fred(ap)
va_list ap ;
{
int i ;
for ( i=0; i < 52 ; i++ ) {
if ( (i%2) == 0 )
printf("%d\n",va_arg(ap, int)) ;
else printf("%f\n", va_arg(ap, double)) ;
}
}
joe(va_alist)
va_dcl
{
va_list ap ;
va_start(ap) ;
fred(ap) ;
va_end(ap) ;
}
main()
{
joe( 1,2.5,3,4.5,5,6.5,7,8.5,9,10.5,11,12.5,13,14.5,15, 16.5, 17,
18.5, 19,20.5,21,22.5,23,24.5,25,26.5,27,28.5,29,30.5,31,32.5,33,34.5,35,36.5,
37,38.5,39,40.5,41,42.5,43,44.5,45,46.5,47,48.5,49,50.5,51,52.5) ;
}
--
Mark Patrick
...{lll-crg, amd, dual}!vecpyr!markl
Visual Engineering Corp, San Jose, CA
More information about the Comp.unix.wizards
mailing list