22.4.1
This commit is contained in:
parent
5118ea044e
commit
f16bd3238d
24
vielmax.c
24
vielmax.c
@ -1,5 +1,27 @@
|
||||
#include <stdio.h>
|
||||
|
||||
for (int i = 0; i < x; ++i) {
|
||||
|
||||
zahl = va_arg(vielmax,int); //Ließt durch die for-Schleife immer den nächsten Parameter ein
|
||||
|
||||
//Findet den größten wert heraus
|
||||
if(zahl >= vorgaenger){
|
||||
max = zahl;
|
||||
}else if (zahl == 0){
|
||||
break;
|
||||
}
|
||||
|
||||
printf("%d ", zahl);
|
||||
vorgaenger = zahl;
|
||||
}
|
||||
printf("ist: %d", max);
|
||||
va_end (vielmax); //Gibt den Speicher wieder frei
|
||||
}
|
||||
|
||||
int main(void){
|
||||
printf("Praktikumsaufgabe");
|
||||
printf("Testprogramm fuer Funktion vielmax()\n");
|
||||
printf("====================================\n\n");
|
||||
printf("Das Maximum der Zahlen ");
|
||||
|
||||
vielmax(100, 24, 5226, 3243, 8238, 23, 22, 1, 0); //100 ist die maximale Anzahl der eingelesenen Zahlen
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user