Test2
This commit is contained in:
parent
4194fc9686
commit
8af445cbc5
@ -1,37 +1,38 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
int main() {
|
int vielmax(int count, ...) {
|
||||||
int vielmax(int count, ...);
|
va_list args;
|
||||||
va_list args;
|
va_start(args, count);
|
||||||
va_start(args, count);
|
|
||||||
|
|
||||||
int max = va_arg(args, int);
|
int max = va_arg(args, int);
|
||||||
|
|
||||||
for (int i = 0; i < count; i++) {
|
for (int i = 1; i < count; i++) {
|
||||||
int num = va_arg(args, int);
|
int num = va_arg(args, int);
|
||||||
if (num>max) {
|
if (num>max) {
|
||||||
max = num;
|
max = num;
|
||||||
}
|
} else if (num == 0) {
|
||||||
}
|
break;
|
||||||
va_end(args);
|
}
|
||||||
return max;
|
}
|
||||||
}
|
va_end(args);
|
||||||
|
return max;
|
||||||
|
}
|
||||||
int main() {
|
int main() {
|
||||||
|
|
||||||
printf("Testprogramm fuer Funktion vielmax ()");
|
printf("Testprogramm fuer Funktion vielmax ()");
|
||||||
printf("=====================================\n\n");
|
printf("=====================================\n\n");
|
||||||
|
|
||||||
|
//int max1 = vielmax(6, 12, 17, 3, 6, 24, 8);
|
||||||
|
//printf("Das Maximum der Zahlen 12, 17, 3, 6, 24, 8: %d", max1);
|
||||||
|
|
||||||
|
int max2 = vielmax(5, 1, 11, 33, 12, 9);
|
||||||
|
printf("Das Maxiumum der Zahlen 1, 11, 33, 12, 9: %d", max2);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// Created by Lennart Pecher on 04.04.25.
|
|
||||||
//
|
|
||||||
//
|
//
|
||||||
// Created by Lennart Pecher on 04.04.25.
|
// Created by Lennart Pecher on 04.04.25.
|
||||||
//
|
//
|
||||||
|
Loading…
x
Reference in New Issue
Block a user