Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
cv8_5
//clang 6.0.0 #include <stdio.h> #define N 8 int ctidata(size_t aSize, double *aData); int minmax(size_t aSize, double *aData, double *aPtrMin, double *aPtrMax); int main(void) { double data[N]; if(ctidata(N, data) == -1) { printf("Chyba cteni vstupnich dat!\n"); return 2; } double min, max; if(minmax(N, data, &min, &max) == -1) { printf("Chyba: Chybne parametry funkce minmax!\n"); return 1; } printf("min=%f max=%f\n", min, max); return 0; } int ctidata(size_t aSize, double *aData) { if(aData == NULL) return -1; printf("Zadej %zu cisel: ", aSize); for(size_t i = 0; i < N; ++i) scanf("%lf", aData + i); return 0; } int minmax(size_t aSize, double *aData, double *aPtrMin, double *aPtrMax) { if(aData == NULL || aPtrMin == NULL || aPtrMax == NULL) return -1; double min, max; min = aData[0]; max = aData[0]; for(size_t i = 1; i < aSize; ++i) { if(aData[i] > max) max = aData[i]; else if(aData[i] < min) min = aData[i]; } *aPtrMin = min; *aPtrMax = max; return 0; }
run
|
edit
|
history
|
help
0
marquee text in C
Vzdalenost
Punteros: creación espacio para un int
CV09-2
min max pole
Vectores: Mayor lista numeros al azar
Herout (67) - 3
Bucles: Mayor de n números hasta teclear 0
fun kce
lab7