bonsoir
j'ai un petit soucis avec des tableaux![]()
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 void attribuer_coefficient(int spe) { float coef[8]; switch(spe) { case 1 : coef[0]=9; coef[1]=6; coef[2]=6;break; case 2 : coef[0]=7; coef[1]=8; coef[2]=6;break; case 3 : coef[0]=7; coef[1]=6; coef[2]=8;break; default : break; }; coef[3]=3; coef[4]=3; coef[5]=3; coef[6]=3; coef[7]=2; printf("\n\n%f\n",coef[0]); printf("%f\n",coef[1]); printf("%f\n",coef[2]); printf("%f\n",coef[3]); printf("%f\n",coef[4]); printf("%f\n",coef[5]); printf("%f\n",coef[6]); printf("%f\n",coef[7]); return (coef); };Le probleme vient du tableau coef
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 int main() { float coef[8]; int spe=1; coef=attribuer_coefficient(spe); printf("\n\n%f\n",coef[0]); printf("%f\n",coef[1]); printf("%f\n",coef[2]); printf("%f\n",coef[3]); printf("%f\n",coef[4]); printf("%f\n",coef[5]); printf("%f\n",coef[6]); printf("%f\n",coef[7]); return(0); };
dans mon main il ne me ressort pas bien les valeurs de coef !!
aidez moi svp![]()
merci
Partager