You are viewing a single comment's thread. Return to all comments →
int sum (int count,...) { int sum = 0; va_list ptr; va_start(ptr, count); for(int i=0; i
int min(int count,...) {
va_list ptr;
va_start(ptr,count);
int min = va_arg(ptr,int);
for(int i=0; i
if (next < min){ min = next; }
} va_end(ptr);
return(min); }
int max(int count,...) { va_list ptr; va_start(ptr,count);
int max = va_arg(ptr,int);
for(int i=0; i max){ max = next; } }
return(max); }
Seems like cookies are disabled on this browser, please enable them to open this website
Variadic functions in C
You are viewing a single comment's thread. Return to all comments →
int sum (int count,...) { int sum = 0; va_list ptr; va_start(ptr, count); for(int i=0; i
int min(int count,...) {
va_list ptr;
va_start(ptr,count);
int min = va_arg(ptr,int);
for(int i=0; i
} va_end(ptr);
return(min); }
int max(int count,...) { va_list ptr;
va_start(ptr,count);
int max = va_arg(ptr,int);
for(int i=0; i max){ max = next; } }
return(max); }