#include <stdio.h>
#include <stdarg.h>
int Max(int n, ...)
{
int i = 0;
int max = 0;
va_list arg;
va_start(arg, n);
for (i = 0; i < n; i++)
{
int val = va_arg(arg,int);
if (val > max)
{
max = val;
}
}
va_end(arg);
return max;
}
int main()
{
int ret = Max(10, 100, 2, 3, 4, 5, 6, 7, 8, 9, 10);
printf("%d\n", ret);
getchar();
return 0;
}
原文地址:http://blog.csdn.net/yangrujing/article/details/45874193