3 [Warning] lors de la compilation d'un programme
salut,
lors de la compilation de mon programme j'ai obtient les erreurs suivants :
(4 C:\Users\makrem\Desktop\SansNom1.c [Warning] "struct etudiant" declared inside parameter list )
(4 C:\Users\makrem\Desktop\SansNom1.c [Warning] its scope is only this definition or declaration, which is probably not what you want )
(5 C:\Users\makrem\Desktop\SansNom1.c [Warning] "struct etudiant" declared inside parameter list )
je veux comprendre mes erreurs et les corriger
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
|
#include<stdio.h>
#include<stdlib.h>
void saisir( struct etudiant * tab , int n );
int calcul_moyg(struct etudiant *tab ,int n1, int n );
typedef struct
{
char mat[10] ;
char nom[20];
char prenom[20];
float *tmoy;
float moyg;
}etudiant;
int main()
{ int n,n1;
int i,j;
etudiant *tab ;
/*****************************************/
printf("entrer le nombre d'etudiant: ");
scanf("%d",&n);
tab=(etudiant*)malloc(n*sizeof(etudiant));
saisir(tab,n);
calcul_moyg(tab,n1,n);
return(0);
}
/******************************************************************************/
void saisir( etudiant * tab , int n )
{ int i,j ;
int n1 ;
float s;
for(i=0;i<n;i++)
{
printf("\nentrer la matricule de l etudiant: \t");
scanf("%s",tab[i].mat);
printf("Entrer le nom de l etudiant: \t ");
scanf("%s",(tab+i)->nom);
printf("entrer la prenom de l etudiant: \t" );
scanf("%s",(tab+i)->prenom);
printf("entrer le nombre de matiere de %s:\t",(tab+i)->prenom);
scanf("%d",&n1);
tab->tmoy=(float*)malloc(n1*sizeof(float));
for(j=0;j<n1;j++)
{printf(" note matiere n°%d =\t",j);
scanf("%f",(tab+i)->tmoy+j);
}
}}
/******************************************************************************/
int calcul_moyg( etudiant *tab ,int n1, int n)
{ float s=0;
int i,j;
for(i=0;i<n;i++)
for(j=0;j<n1;j++)
s+=*(tab+i)->tmoy+j ;
(tab+i)->moyg = s/n1 ;
printf("le moy generale est: %f",(tab+i)->moyg);
return (0);
} |