I have a problem with my while loop, I want to exit the loop once my motTrouve function returns 1 but it loops one time more than it should
#include <stdio.h>
#include <string.h>
#include "logicPendu.h"
int main(){
int essais = 0, *Pessais = &essais, continuer = 0;
char lettresCherches[100] = {0}, lettreUtilisateur = 0, *PlettreUtilisateur = &lettreUtilisateur, motUtilisateur[100] = {0}, motOrdinateur[] = "bite";
while(!gameOver(essais) && !motTrouve(motOrdinateur, motUtilisateur))
{
affichagePendu(Pessais);
affichageMot(motOrdinateur, lettresCherches, motUtilisateur);
printf("Donnez une lettre : n");
scanf(" %c", &lettreUtilisateur);
lettreDansLeMot(motOrdinateur, PlettreUtilisateur, lettresCherches, Pessais);
}
return 0;
}
thank you for your response
I have tried to put a if statement with a break inside the loop as well as a continue but i didn’t work
New contributor
Onix is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.