Here is the problem i have to solve.
In main, i declare a matrix, mat[12][24]
Then I call a funtion and send it the adresse of my matrix as a parameter.
In this new sub function, i am supposed to send the adresse of a row of my matrix to a second function wich then fills colomuns 7 to 19 of the row it received.
The output is simply wrong, it sould be:
0
0
0
0
0
0
6
7
8
9
10
11
12
13
14
15
16
17
0
0
0
0
0
0
times 12 because there are 12 rows.
the output for the first row is this, and the other rows all have the twelve first numbers in comon exept the 12 following are stranger:Code:#include <stdio.h> #include <stdlib.h> #include <math.h> float fonction(float[][24]); float rayonnementJour(float*); int i, h, p; int main() { float mat[12][24]; fonction(mat); i = 0; do { for(h = 0; h < 24; h++) { printf("\n %f ", mat[i][h]); } printf("\n"); i += 1; }while(i < 12); system("PAUSE"); return 0; } float fonction(float mat[][24]) { for(i = 0; i < 12; i++) { rayonnementJour(mat[i]); } } float rayonnementJour(float *heureptr) { *heureptr += 6; for(h = 6; h < 18; h++) { *heureptr = h; *heureptr++; } }
6.000000
7.000000
8.000000
9.000000
10.000000
11.000000
12.000000
13.000000
14.000000
15.000000
16.000000
17.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
6070641818228166000000000000000000000.000000
0.000000