Avancement dans l'affichage graphique du tableau, mais bug rencontré dans les valeurs du tableau

This commit is contained in:
2023-11-24 01:32:37 +01:00
parent b61b2de79a
commit dc9ba3e4fe
2 changed files with 97 additions and 5 deletions

View File

@@ -11,13 +11,25 @@
#define NBR_POMME 5
#define TAILLE_SERPENT 10
int* plateauinit(void) {
int** plateau_init(void) {
int ligne_pomme, colonne_pomme, i;
int ** tableau = NULL;
int tableau[LIGNES][COLONNES] = {0}, ligne_pomme, colonne_pomme, i, i2, compteur = 0 ;
srand(time(NULL));
/* allocation du tableau dans le tas */
tableau = calloc(LIGNES, sizeof(int));
for ( i = 0; i < LIGNES; i++) {
tableau[i] = calloc(COLONNES, sizeof(int));
}
/* positionnement du serpent */
@@ -50,11 +62,12 @@ int* plateauinit(void) {
}
/* le chiffre definit une pomme */
/* le chiffre "2" definit une pomme */
tableau[ligne_pomme][colonne_pomme] = 2;
}