From 7d7a69d06ec00a92ed673ce6eb72f8dbb6ddf0aa Mon Sep 17 00:00:00 2001 From: "julien.abadie" Date: Fri, 10 Nov 2023 19:28:19 +0100 Subject: [PATCH] correction tmax dans basket add --- src/panier.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/panier.c b/src/panier.c index ff35784..b5978b3 100644 --- a/src/panier.c +++ b/src/panier.c @@ -136,6 +136,11 @@ void basket_add(int tab_reference[], float unitPrice[], float *cagnotte, int ba { int i, ref_to_add, qte_to_add, trouve, index_ajout; float total_weight[tmaxArticles], total_volume[tmaxArticles], total_price[tmaxArticles], total_cagnotte[tmaxArticles]; + if (tlogItem+1>tmaxArticles) + { + printf("erreur, pas assez de place pour ajouter un autre article"); + return; + } printf("Quelle référence souhaitez-vous ajouter au panier?"); scanf("%d", &ref_to_add); index_ajout = searchTab(tab_reference, ref_to_add, tlogItem, &trouve);