home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The C Users' Group Library 1994 August
/
wc-cdrom-cusersgrouplibrary-1994-08.iso
/
listings
/
v_10_04
/
1004111a
< prev
next >
Wrap
Text File
|
1992-02-10
|
545b
|
32 lines
Listing 10
******
#include <stdarg.h>
int maximum(int count, int first,...);
main()
{
int ret;
ret = maximum(6, 2,3,4,5,9,8);
printf("Maximum is %d\n", ret);
}
int maximum(int count,int first,...)
{
va_list arguments;
int i;
int value;
int maximum = first;
va_start(arguments, first);
for (i = 0; i < count - 1; i++)
{
value = va_arg(arguments, int);
if (value > maximum)
maximum = value;
}
va_end(arguments);
return maximum;
}
*****