Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
variable number of arguments 3
#include <stdlib.h> #include <stdarg.h> #include <stdio.h> extern int maxof(int, ...); extern void f(void); int main() { f(); return 0; } // number of argumants, [list of integers...] int maxof(int n_args, ...) { register int i; int max; int a; va_list ap; va_start(ap, n_args); max = va_arg(ap, int); for(i = 2; i <= n_args; i++) { a = va_arg(ap, int); if ( a > max) { max = a; } } va_end(ap); return max; } void f(void) { int i = 5; int j[256]; j[42] = 24; printf("%d\n", maxof(4, i, j[42], 0, 654) ); }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
A_141124arrayRepetidos
Stub Program for Problem 2 HW 2
to find a number is even or not
Función bsearch
Shapes and such
Prime no
150109_RecursividadPrimo
Arrays Grtade and Toppers
Project 3 Part 1 v1.4
fgets and basic string manipulation
Please log in to post a comment.