Yûki - Add DEBUG State

This commit is contained in:
name 2019-12-15 05:05:15 +01:00
parent b2e8b8f388
commit 35865485a0
No known key found for this signature in database
GPG key ID: 03E8F3CF3183323A
3 changed files with 23 additions and 5 deletions

View file

@ -3,7 +3,9 @@
#include <assert.h>
#include <string.h>
#include "arbre_binaire.h"
#ifdef DEBUG
#define DEBUG 1
#endif
arbre creer_arbre_vide (void)
{
return NULL ;
@ -70,8 +72,23 @@ void free_arbre(arbre a)
}
void arbre_rechercher(arbre a, Elt c, char s[], int s_len, int found[]){
/*
De ce que j'ai testé, ça marche de temps en temps même en ne changeant pas le caractère recherché, je pense qu'il y a un problème avec VSCode encore une fois LOL (Yûki)
*/
#ifdef DEBUG
printf("\nDEBUG ARBRE RECHERCHER : \n");
printf(" est_arbre_vide(a) : %d\n",est_arbre_vide(a));
printf(" est_feuille(a) : %d\n",est_feuille(a));
printf(" racine(a) : %c\n",racine(a));
printf(" c : %c\n",c);
printf(" est_arbre_vide(fils_gauche(a)) : %d\n",est_arbre_vide(fils_gauche(a)));
printf(" est_arbre_vide(fils_droit(a)) : %d\n",est_arbre_vide(fils_droit(a)));
printf(" S : %s\n",s);
printf("--FIN DEBUG ARBRE RECHERCHER--\n");
#endif
if(!est_arbre_vide(a)){
if(est_feuille(a)&&racine(a)==c){
if((a->fils_gauche==NULL&&a->fils_droit==NULL)&&racine(a)==c){
found[0]=1;
return ;
}
@ -83,5 +100,6 @@ void arbre_rechercher(arbre a, Elt c, char s[], int s_len, int found[]){
s[s_len]='1';
arbre_rechercher(fils_droit(a),c,s,s_len+1,found);
}
}
}

View file

@ -1 +1 @@
Ceci est un test.
mon code C est le meilleure : int myfunction(arbre ahah){printf("coucou");pointeur->quipointe;}

View file

@ -41,9 +41,9 @@ int main(int argc, char **argv){
// Récupération du code de chaque charactere
printf("Code : \n");
char s[8]="2";
char s[80]="";
int f[1]={0};
char search=' ';
char search='-';
arbre_rechercher(huff,search,s,0,f);
if(f[0]==1){
printf("\nTrouve : %s\n",s);