Lien entre header et main.c

curnyx -  
 Utilisateur anonyme -
Bonjour, j'ai un problème avec ce programme. Il ne reconnait pas les fonction et donc ne s'exécute pas.Pouvez vous m'aidez à résoudre ce problème?!

main.c

#include <stdio.h>
#include <stdlib.h>
#include "fonction.h"

int main() {
Partie;
inittab(Partie *parite);
afficheTab(Partie);
return 0;
}

fonction.h

#ifndef OTH_H_INCLUDED
#define OTH_H_INCLUDED

typedef struct Partie {
int tab[8][8];
int joueurSuivant; // Noires = 1, Blancs = 2
int nombreDePions[2]; // [0] pour les noires et [1] pour les blancs
} Partie;

int inittab(Partie *parite);
void afficheTab(Partie);
void affichegrille();

#endif // OTH_H_INCLUDED

fonction.c

void affichegrille() {
int i;
for (i = 0; i < 7; i++)
printf("****");
puts("*");
}

void afficheTab(Partie)
{
int a, j;
int nbb = 0, nbn = 0;
printf(" a b c d e f g h\n");

for (a = 0; a < 7; a++) {
affichegrille();
for (j = 0; j < 7; j++) {

if(tab[a][j] == 0)
printf("* \n");
printf("* \n");
printf("* \n");
else
{

if(tab[a][j] == 1)
{
printf("* \n");
printf("* N ");
printf("* \n");
nbn++;
}

else
{
printf("* \n");
printf("* B ");
printf("* \n");
nbb++;
}
}
}

printf("* %d", a);
puts(" ");
}
affichegrille();
printf("il y a %d noirs\nil y a %d blancs\n", nbn, nbb);
}

1 réponse

  1. Utilisateur anonyme
     
    salut

    il faut que ton
    fonction.c 
    integre
    fonction.o 


    et ton
    main.c 
    inclu
    fonction.c 


    de même, tes déclaration se feront dans ton .h plutot que le main (en fait il faut que tes classes/.h soient autosuffisant et ne dépendent pas du mais => c'est l'inverse)

    naga
    0