Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
variable number of arguments
#include <stdlib.h> #include <stdarg.h> #include <stdio.h> int maxof(int, ...) ; void f(void); int main() { f(); exit(EXIT_SUCCESS); return 0; } int maxof(int n_args, ...){ register int i; int max, a; va_list ap; va_start(ap, n_args); max = va_arg(ap, int); for(i = 2; i <= n_args; i++) { if((a = va_arg(ap, int)) > max) max = a; } va_end(ap); return max; } void f(void) { int i = 5; int j[256]; j[42] = 24; printf("%d\n",maxof(3, i, j[42], 0)); }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Kous
FileCat
C_141113_Primo01
string_ptr_to_fct_param
Lab 8 part 2 v.06
qsort para struct
Conditional logic.c
prueba 3
sume of diagonal v.1
pthread_monte_carlo_pi.c
Please log in to post a comment.