|
|
|
|
Configuration: Linux Firefox 2.0.0.2
Bonjour,
Sans appel. Compiling... main.cpp main.cpp(65) : error C2057: expected constant expression main.cpp(65) : error C2466: cannot allocate an array of constant size 0 main.cpp(65) : error C2133: 'tin' : unknown size main.cpp(67) : error C2057: expected constant expression main.cpp(67) : error C2466: cannot allocate an array of constant size 0 main.cpp(67) : error C2133: 't' : unknown size main.cpp(78) : error C2057: expected constant expression main.cpp(78) : error C2466: cannot allocate an array of constant size 0 main.cpp(78) : error C2133: 'suivant' : unknown size main.cpp(85) : warning C4244: '=' : conversion from 'int' to 'float', possible loss of data main.cpp(105) : warning C4244: '=' : conversion from 'float' to 'int', possible loss of data main.cpp(115) : warning C4244: '=' : conversion from 'int' to 'float', possible loss of data main.cpp(120) : warning C4244: '=' : conversion from 'int' to 'float', possible loss of data main.cpp(121) : warning C4244: '=' : conversion from 'int' to 'float', possible loss of data main.cpp(129) : warning C4244: '=' : conversion from 'float' to 'int', possible loss of data ---------------------- Done ---------------------- Build: 0 succeeded, 1 failed, 0 skipped Les trois premières qui sont au début du main sont déjà suffisantes pour éviter un joli seg fault. Essaie d'activer un peu plus de retours de la part de ton compilateur, ça peut aider... M.
|
Correction de tes 2 méthodes :
struct meteo * saisie (int *n)
{
int i, nb;
struct meteo *t;
printf("donnez la taille de votre tableau\n");
scanf("%d",&nb);
t = (struct meteo *)calloc(nb, sizeof(struct meteo));
for(i=0;i<nb;i++)
{
scanf("%f",&t[i].tempmin);
scanf("%f",&t[i].tempmax);
scanf("%d",&t[i].hygro);
scanf("%f",&t[i].pluis);
}
*n = nb;
return t;
}
void affiche(int n ,struct meteo *t)
{
int i;
printf("la taille du tableau:%d\n",n);
for(i=0;i<n;i++)
{
printf("%f\n",t[i].tempmin);
printf("%f\n",t[i].tempmax);
printf("%d\n",t[i].hygro);
printf("%f\n",t[i].pluis);
}
}
Le début de ton main : int main()
{
int n; /*nombre de valeurs à trier*/
float *tin; /*le tableau retourne*/
int entiere ; /*la valeur entiiere à retournee*/
struct meteo *tab; /*le tableau saisie par l utilisateur*/
tab = saisie(&n);
affiche(n,tab);
}
-- Alex pour vous servir --
-- N'oubliez pas de mettre vos sujets en "Résolu" lorsque vous avez la réponse ;-) -- |