#include <stdio.h>
#include <stdarg.h>
#include <float.h>
double max(int count, ...)
{
double max = -DBL_MAX, test;
va_list values;
va_start(values, count);https://i...content-available-to-author-only...e.com/OfpjUi#
for(int i = 0; i < count; ++i)
{
test = va_arg(values, double);
if(test > max)
{
max = test;
}
}
va_end(values);
return max;
}
int main()
{
printf("%lf", max(5,1.0,6.0,-31.0,23.0,24.0));
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdGRhcmcuaD4KI2luY2x1ZGUgPGZsb2F0Lmg+Cgpkb3VibGUgbWF4KGludCBjb3VudCwgLi4uKQp7CiAgICBkb3VibGUgbWF4ID0gLURCTF9NQVgsIHRlc3Q7CgogICAgdmFfbGlzdCB2YWx1ZXM7CiAgICB2YV9zdGFydCh2YWx1ZXMsIGNvdW50KTtodHRwczovL2kuLi5jb250ZW50LWF2YWlsYWJsZS10by1hdXRob3Itb25seS4uLmUuY29tL09mcGpVaSMKICAgIGZvcihpbnQgaSA9IDA7IGkgPCBjb3VudDsgKytpKQogICAgewogICAgICAgIHRlc3QgPSB2YV9hcmcodmFsdWVzLCBkb3VibGUpOwogICAgICAgIGlmKHRlc3QgPiBtYXgpCiAgICAgICAgewogICAgICAgICAgICBtYXggPSB0ZXN0OwogICAgICAgIH0KICAgIH0KICAgIHZhX2VuZCh2YWx1ZXMpOwogICAgcmV0dXJuIG1heDsKfQoKaW50IG1haW4oKQp7CiAgICBwcmludGYoIiVsZiIsIG1heCg1LDEuMCw2LjAsLTMxLjAsMjMuMCwyNC4wKSk7CiAgICByZXR1cm4gMDsKfQ==