Correction d'erreur

This commit is contained in:
Arnaud NGWALA NGWALA 2023-10-13 10:03:20 +02:00
parent 82cf22952d
commit cdbec2b91f

View File

@ -41,17 +41,17 @@ int main(int argc, char **argv){
demi_f[i].n1 = duels[i*2].max; demi_f[i].n1 = duels[i*2].max;
demi_f[i].n2 = duels[i*2+1].max; demi_f[i].n2 = duels[i*2+1].max;
demi_f[i].max = 0; demi_f[i].max = 0;
pthread_create(&threads[i], NULL, max, (void*) (duels + i)); pthread_create(&threads[i], NULL, max, (void*) (demi_f + i));
} }
for (int i = 0; i < 2;i++){ for (int i = 0; i < 2;i++){
pthread_join(threads[i], NULL); pthread_join(threads[i], NULL);
} }
numbers finale = {0}; numbers finale = {};
finale.n1 = demi_f[0].max; finale.n1 = demi_f[0].max;
finale.n2 = demi_f[1].max; finale.n2 = demi_f[1].max;
pthread_create(&threads[0], NULL, max, (void*) (&finale)); pthread_create(&threads[0], NULL, max, (void*) (&finale));
pthread_join(threads[0], NULL); pthread_join(threads[0], NULL);
printf("Le plus grand des huits nombres est : %d", finale.max); printf("Le plus grand des huits nombres est : %d\n", finale.max);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }