Bonjour,
l'erreur décrite dans le titre concerne la ligne où est appelée ma fonction saisieDeNote. J'ai beau chercher, je ne vois pas ce qui cloche (à part que je vais probablement chercher à changer l'ecriture et la logique du code qui compare les deux flottants).
#include <stdio.h> #include <stdlib.h> #include <inttypes.h> #include <stdbool.h> #ifdef _WIN64 #include <windows.h> #define psleep(sec) Sleep((sec) * 1000) #define clear() system("cls") #else #include <unistd.h> #define psleep(sec) sleep((sec)) #define clear() system("clear") #endif // _WIN64 struct test { int ligne; struct { int32_t taille; float notesSaisies[INT32_MAX]; }in; struct { float prevision[INT32_MAX]; }out; float tabNote[INT32_MAX]; }; void saisieDeNote(float tab[], int32_t laTaille, float note[]); int main(void) { size_t i; bool ok = true; int32_t j; float tableauNote[INT32_MAX]; struct test a[] = { {1, {1, {1.0}}, {{1.0}}, {tableauNote[0]}}, {2, {1, {0.0}}, {{0.0}}, {tableauNote[0]}}, {3, {1, {7.8}}, {{7.8}}, {tableauNote[0]}}, {4, {2,{12.0, 15.0}}, {{12.0, 15.0}}, {tableauNote[0], tableauNote[1]}}, {5, {2, {7.8, 19.3}}, {{7.8, 19.3}}, {tableauNote[0], tableauNote[1]}}, {6, {3, {20.0, 0.0, 17.8}}, {{20.0, 0.0, 17.8}}, {tableauNote[0], tableauNote[1], tableauNote[2]}}, /*{7, {3, {20.0, 17.8}},{{20.0, 17.8}}, {tableauNote[0], tableauNote[1]}},*/ /*{8, {2, {20.0, 17.8}}, {{20.0, 16.0}}, {tableauNote[0], tableauNote[1]}},*/ }; for(i = 0 ; i < sizeof a / sizeof *a ; i++) { struct test *p = a + i; void saisieDeNote(tableauNote, p->in.taille, p->in.notesSaisies); for(j = 0 ; ok == true && j < p->in.taille ; j++) { if(p->out.prevision[j] * 100 == tableauNote[j] * 100) { printf("Erreur a la ligne %d, effet de bord non conforme\n", p->ligne); ok = false; } } } if(ok == true) puts("P A S S E D"); return 0; } void saisieDeNote(float tab[], int32_t laTaille, float note[]) { int32_t i; for(i = 0 ; i < laTaille ; i++) { printf("Saisie de la note %"PRId32" :\n", i + 1); tab[i] = note[i]; } }
Configuration: Windows / Firefox 79.0
Afficher la suite