motion planning in c++

please i need help , i'm writing a code to generate a vector field in grids and compute the cost over each grids then, use a method to find the smallest path in order to reach a goal, when i compile my program i have this error: array bound is not an integer constant before ']' token,here is the program

#include <iostream>
#include <cmath>
using namespace std;

int m=3,n=3;
int M[3][3];
int V[m][n];
float C[m][n];


int root(float a,float b)
{
float delta,h0,epsi,f1,hn,f2,hnext,fp1,fp2;
h0=0;
epsi=0.01;
delta=0.2;


f1=a-b+((2*h0-1)/sqrt(pow(h0,2)+pow(1-h0,2)));
hn=h0+delta;
f2=a-b+((2*hn-1)/sqrt(pow(hn,2)+pow(1-hn,2)));
if(f1*f2==0) cout<<"the root is"<<hn;

while (f1*f2>0)
{
h0=hn;
f1=a-b+((2*h0-1)/sqrt(pow(h0,2)+pow(1-h0,2)));
hn=h0+delta;
f2=a-b+((2*hn-1)/sqrt(pow(hn,2)+pow(1-hn,2)));

}
while(f2*f1<0)
{
f2=a-b+((2*hn-1)/sqrt(pow(hn,2)+pow(1-hn,2)));

fp1=(2/sqrt(pow(hn,2)+pow(1-hn,2)))-(((2*hn-1)*(4*hn-2))/(2*pow(pow(hn,2)+pow(1-hn,2),(3/2))));


fp2=((-12*hn+6)/pow(pow(hn,2)+pow(1-hn,2),(3/2)))+(((6*hn-3)*pow(4*hn-2,2))/(4*pow(2*pow(hn,2)+1+2*hn,(5/2))));


hnext=hn-(f2/(fp1-(fp2*f2/2*fp1)));
if (abs(hnext-hn)<epsi)
{

cout<<"the root is"<<hnext;
return hnext;
}
else hn=hnext;
}
}




void ortho(int V[m][n],int M[m][n],float C[m][n],int h,int k)
{
if (V[h+1][k]==-1&&M[h+1][k]==0)
C[h+1][k]=1;
if(V[h-1][k]==-1&&M[h-1][k]==0)
C[h-1][k]=1;
if (V[h][k+1]==-1&&M[h][k+1]==0)
C[h][k+1]=1;
if (V[h][k-1]==-1&&M[h][k-1]==0)
C[h][k-1]=1;
return;

}


void corner(int V[m][n],int M[m][n],float C[m][n],int h,int k)
{
if (V[h-1][k+1]==-1&&M[h-1][k+1]==0 )
inter1(V,C,M,h,k);
if (V[h-1][k-1]==-1&&M[h-1][k-1]==0 )
inter2(V,C,M,h,k);
if (V[h+1][k+1]==-1&&M[h+1][k+1]==0 )
inter3(V,C,M,h,k);
if (V[h+1][k-1]==-1&&M[h+1][k-1]==0 )
inter4(V,C,M,h,k);
return;
}
void inter1(int V[m][n],int M[m][n],float C[m][n],int h,int k)
{ float y=0,z=0;
if(M[h-1][k]==0&&M[h][k+1]==0)
{
y=C[h-1][k]; z=C[h][k+1];
x=root(z,y);
C[h-1][k+1]=x*z+(1-x)*y+sqrt(pow(x,2)+pow(1-x,2));

}
else if (M[h-1][k]==0&&M[h][k+1]!=0)
C[h-1][k+1]=C[h-1][k]+1;
else if (M[h-1][k]!=0&&M[h][k+1]==0)
C[h-1][k+1]=C[h][k+1]+1;
else cout<<"find solution!"<<endl;
return;
}


void inter2(int V[m][n],int M[m][n],float C[m][n],int h,int k)
{ float l=0,f=0;
if(M[h-1][k]==0&&M[h][k-1]==0)
{
l=C[h-1][k]; f=C[h][k-1];
x=root(f,l);
C[h-1][k-1]=x*f+(1-x)*l+sqrt(pow(x,2)+pow(1-x,2));

}
else if (M[h-1][k]==0&&M[h][k-1]!=0)
C[h-1][k-1]=C[h-1][k]+1;
else if (M[h-1][k]!=0&&M[h][k-1]==0)
C[h-1][k-1]=C[h][k-1]+1;
else cout<<"find solution!"<<endl;
return;
}


void inter3(int V[m][n],int M[m][n],float C[m][n],int h,int k)
{ float t=0,w=0;
if(M[h][k+1]==0&&M[h+1][k]==0)
{
t=C[h][k+1]; w=C[h+1][k];
x=root(t,w);
C[h+1][k+1]=x*t+(1-x)*w+sqrt(pow(x,2)+pow(1-x,2));

}
else if (M[h][k+1]==0&&M[h+1][k]!=0)
C[h+1][k+1]=C[h][k+1]+1;
else if (M[h][k+1]!=0&&M[h+1][k]==0)
C[h+1][k+1]=C[h+1][k]+1;
else cout<<"find solution!"<<endl;
return;
}

void inter4(int V[m][n],int M[m][n],float C[m][n],int h,int k)
{ float d=0,e=0;
if(M[h][k-1]==0&&M[h+1][k]==0)
{
d=C[h][k-1]; e=C[h+1][k];
x=root(d,e);
C[h+1][k-1]=x*d+(1-x)*e+sqrt(pow(x,2)+pow(1-x,2));

}
else if (M[h][k-1]==0&&M[h+1][k]!=0)
C[h+1][k-1]=C[h][k-1]+1;
else if (M[h][k-1]!=0&&M[h+1][k]==0)
C[h+1][k-1]=C[h+1][k]+1;
else cout<<"find solution!"<<endl;
return;
}
int main()
{
int i,j,h=0,k=0;
for (i=0,i<m,i++)
{
for (j=0,j<n,j++)
{
C[i][j]=0:
V[i][j]=-1;
}
}
int M[3][3]={{0,0,1},{0,0,0},{0,0,0}};
int ag=2; bg=2;

for (i=0,i<=ag,i++)
{
for (j=0,j<=n-1-bg,j++)
{
if (V[ag-i][bg+j]==-1&&M[ag-i][bg+j]==0)
{
h=ag-i; k=bg+j;
ortho(V,C,M,h,k);
corner(V,C,M,h,k);
V[h][k]=1;
}
}
}
for (i=0,i<=m-1-ag,i++)
{
for (j=0,j<=n-1-bg,j++)
{
if (V[ag+i][bg+j]==-1&&M[ag+i][bg+j]==0)
{
h=ag+i; k=bg+j;
ortho(V,C,M,h,k);
corner(V,C,M,h,k);
V[h][k]=1;
}
}
}
for (i=0,i<=ag,i++)
{
for (j=0,j<=bg,j++)
{
if (V[ag-i][bg-j]==-1&&M[ag-i][bg-j]==0)
{
h=ag-i; k=bg-j;
ortho(V,C,M,h,k);
corner(V,C,M,h,k);
V[h][k]=1;
}
}
}
for (i=0,i<=m-1-ag,i++)
{
for (j=0,j<=bg,j++)
{
if (V[ag+i][bg-j]==-1&&M[ag+i][bg-j]==0)
{
h=ag+i; k=bg-j;
ortho(V,C,M,h,k);
corner(V,C,M,h,k);
V[h][k]=1;
}
}
}
for(i=0,i<4,i++)
{
for(j=0,j<4,j++)
{
cout<<C[i][j];
}
}
}

Please edit your post and make sure your code is [code]between code tags[/code] so that it has line numbers, as well as syntax highlighting and proper indentation.
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
#include <iostream>
#include <cmath>
using namespace std;

int m=3,n=3;
int M[3][3];
int V[m][n];
float C[m][n];


int root(float a,float b)
{
float delta,h0,epsi,f1,hn,f2,hnext,fp1,fp2;
h0=0;
epsi=0.01;
delta=0.2;


f1=a-b+((2*h0-1)/sqrt(pow(h0,2)+pow(1-h0,2)));
hn=h0+delta;
f2=a-b+((2*hn-1)/sqrt(pow(hn,2)+pow(1-hn,2)));
if(f1*f2==0) cout<<"the root is"<<hn;

while (f1*f2>0)
{
h0=hn;
f1=a-b+((2*h0-1)/sqrt(pow(h0,2)+pow(1-h0,2)));
hn=h0+delta;
f2=a-b+((2*hn-1)/sqrt(pow(hn,2)+pow(1-hn,2)));

}
while(f2*f1<0)
{
f2=a-b+((2*hn-1)/sqrt(pow(hn,2)+pow(1-hn,2)));

fp1=(2/sqrt(pow(hn,2)+pow(1-hn,2)))-(((2*hn-1)*(4*hn-2))/(2*pow(pow(hn,2)+pow(1-hn,2),(3/2))));


fp2=((-12*hn+6)/pow(pow(hn,2)+pow(1-hn,2),(3/2)))+(((6*hn-3)*pow(4*hn-2,2))/(4*pow(2*pow(hn,2)+1+2*hn,(5/2))));


hnext=hn-(f2/(fp1-(fp2*f2/2*fp1)));
if (abs(hnext-hn)<epsi)
{

cout<<"the root is"<<hnext;
return hnext;
}
else hn=hnext;
}
}




void ortho(int V[m][n],int M[m][n],float C[m][n],int h,int k)
{
if (V[h+1][k]==-1&&M[h+1][k]==0)
C[h+1][k]=1;
if(V[h-1][k]==-1&&M[h-1][k]==0)
C[h-1][k]=1;
if (V[h][k+1]==-1&&M[h][k+1]==0)
C[h][k+1]=1;
if (V[h][k-1]==-1&&M[h][k-1]==0)
C[h][k-1]=1;
return;

}


void corner(int V[m][n],int M[m][n],float C[m][n],int h,int k)
{
if (V[h-1][k+1]==-1&&M[h-1][k+1]==0 )
inter1(V,C,M,h,k);
if (V[h-1][k-1]==-1&&M[h-1][k-1]==0 )
inter2(V,C,M,h,k);
if (V[h+1][k+1]==-1&&M[h+1][k+1]==0 )
inter3(V,C,M,h,k);
if (V[h+1][k-1]==-1&&M[h+1][k-1]==0 )
inter4(V,C,M,h,k);
return;
}
void inter1(int V[m][n],int M[m][n],float C[m][n],int h,int k)
{ float y=0,z=0;
if(M[h-1][k]==0&&M[h][k+1]==0)
{
y=C[h-1][k]; z=C[h][k+1];
x=root(z,y);
C[h-1][k+1]=x*z+(1-x)*y+sqrt(pow(x,2)+pow(1-x,2));

}
else if (M[h-1][k]==0&&M[h][k+1]!=0)
C[h-1][k+1]=C[h-1][k]+1;
else if (M[h-1][k]!=0&&M[h][k+1]==0)
C[h-1][k+1]=C[h][k+1]+1;
else cout<<"find solution!"<<endl;
return;
}


void inter2(int V[m][n],int M[m][n],float C[m][n],int h,int k)
{ float l=0,f=0;
if(M[h-1][k]==0&&M[h][k-1]==0)
{
l=C[h-1][k]; f=C[h][k-1];
x=root(f,l);
C[h-1][k-1]=x*f+(1-x)*l+sqrt(pow(x,2)+pow(1-x,2));

}
else if (M[h-1][k]==0&&M[h][k-1]!=0)
C[h-1][k-1]=C[h-1][k]+1;
else if (M[h-1][k]!=0&&M[h][k-1]==0)
C[h-1][k-1]=C[h][k-1]+1;
else cout<<"find solution!"<<endl;
return;
}


void inter3(int V[m][n],int M[m][n],float C[m][n],int h,int k)
{ float t=0,w=0;
if(M[h][k+1]==0&&M[h+1][k]==0)
{
t=C[h][k+1]; w=C[h+1][k];
x=root(t,w);
C[h+1][k+1]=x*t+(1-x)*w+sqrt(pow(x,2)+pow(1-x,2));

}
else if (M[h][k+1]==0&&M[h+1][k]!=0)
C[h+1][k+1]=C[h][k+1]+1;
else if (M[h][k+1]!=0&&M[h+1][k]==0)
C[h+1][k+1]=C[h+1][k]+1;
else cout<<"find solution!"<<endl;
return;
}

void inter4(int V[m][n],int M[m][n],float C[m][n],int h,int k)
{ float d=0,e=0;
if(M[h][k-1]==0&&M[h+1][k]==0)
{
d=C[h][k-1]; e=C[h+1][k];
x=root(d,e);
C[h+1][k-1]=x*d+(1-x)*e+sqrt(pow(x,2)+pow(1-x,2));

}
else if (M[h][k-1]==0&&M[h+1][k]!=0)
C[h+1][k-1]=C[h][k-1]+1;
else if (M[h][k-1]!=0&&M[h+1][k]==0)
C[h+1][k-1]=C[h+1][k]+1;
else cout<<"find solution!"<<endl;
return;
}
int main()
{
int i,j,h=0,k=0;
for (i=0,i<m,i++)
{
for (j=0,j<n,j++)
{
C[i][j]=0:
V[i][j]=-1;
}
}
int M[3][3]={{0,0,1},{0,0,0},{0,0,0}};
int ag=2; bg=2;

for (i=0,i<=ag,i++)
{
for (j=0,j<=n-1-bg,j++)
{
if (V[ag-i][bg+j]==-1&&M[ag-i][bg+j]==0)
{
h=ag-i; k=bg+j;
ortho(V,C,M,h,k);
corner(V,C,M,h,k);
V[h][k]=1;
}
}
}
for (i=0,i<=m-1-ag,i++)
{
for (j=0,j<=n-1-bg,j++)
{
if (V[ag+i][bg+j]==-1&&M[ag+i][bg+j]==0)
{
h=ag+i; k=bg+j;
ortho(V,C,M,h,k);
corner(V,C,M,h,k);
V[h][k]=1;
}
}
}
for (i=0,i<=ag,i++)
{
for (j=0,j<=bg,j++)
{
if (V[ag-i][bg-j]==-1&&M[ag-i][bg-j]==0)
{
h=ag-i; k=bg-j;
ortho(V,C,M,h,k);
corner(V,C,M,h,k);
V[h][k]=1;
}
}
}
for (i=0,i<=m-1-ag,i++)
{
for (j=0,j<=bg,j++)
{
if (V[ag+i][bg-j]==-1&&M[ag+i][bg-j]==0)
{
h=ag+i; k=bg-j;
ortho(V,C,M,h,k);
corner(V,C,M,h,k);
V[h][k]=1;
}
}
}
for(i=0,i<4,i++)
{
for(j=0,j<4,j++)
{
cout<<C[i][j];
}
}
}
You accidentally submitted a new post instead of editing your original post. It's too late to fix it now.

You accidentally removed all the indentation - this makes it really hard to read the code.

The error is because you forgot to write const on line 3:

int const m=3,n=3;
thank you so much , i'm sorry i had to edit my post but a did a new one , i'm beginner with this forum :) ok thanks for your answer, when i compile again my program i had this error: 140|error: cannot convert 'float (*)[3]' to 'int (*)[3]' for argument '2' to 'void inter1(int (*)[3], int (*)[3], float (*)[3], int, int)'|can any one help me to fix it please?
Your arrays are not being built properly. Maybe it can work that way, but there are much easier ways. I would recommend a prototype at least to declare your arrays or perhaps a struct.

as for your initialization, you want something like this.
const int SIZEM = 4; // this sets the number of parts in the array.
const int SIZEN = 3;
void display(double [SIZEM][SIZEN]); //declaration

Then be sure to initialize in your main and your functions.

A struct or a class would be very helpful to clarify your separate operations.
... and another thing. C++ does not do bounds checking if you exceed the array size.
You can test by adding this simple loop...
if(n >= MAX)
{
cout << "The array is full. ";
break;
}
i have done what u have said i dn't know if i did it correctly or not but the error was fixed, when i compile it i had another error : expected unqualified-id before 'double'| and error: expected ')' before 'double'| in line 85 thank you :)
here is the program:
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
#include <iostream>
#include <cmath>
using namespace std;

const int SIZEM = 4;const int SIZEN = 3;;
int M[3][3];
int V[SIZEM][SIZEN];
float C[SIZEM][SIZEN];


int root(float a,float b)
{
    float   delta,h0,epsi,f1,hn,f2,hnext,fp1,fp2;
    h0=0;
    epsi=0.01;
    delta=0.2;


    f1=a-b+((2*h0-1)/sqrt(pow(h0,2)+pow(1-h0,2)));
    hn=h0+delta;
    f2=a-b+((2*hn-1)/sqrt(pow(hn,2)+pow(1-hn,2)));
    if(f1*f2==0)   cout<<"the  root    is"<<hn;

    while   (f1*f2>0)
{
    h0=hn;
    f1=a-b+((2*h0-1)/sqrt(pow(h0,2)+pow(1-h0,2)));
    hn=h0+delta;
    f2=a-b+((2*hn-1)/sqrt(pow(hn,2)+pow(1-hn,2)));

}
while(f2*f1<0)
{
    f2=a-b+((2*hn-1)/sqrt(pow(hn,2)+pow(1-hn,2)));

    fp1=(2/sqrt(pow(hn,2)+pow(1-hn,2)))-(((2*hn-1)*(4*hn-2))/(2*pow(pow(hn,2)+pow(1-hn,2),(3/2))));


    fp2=((-12*hn+6)/pow(pow(hn,2)+pow(1-hn,2),(3/2)))+(((6*hn-3)*pow(4*hn-2,2))/(4*pow(2*pow(hn,2)+1+2*hn,(5/2))));


    hnext=hn-(f2/(fp1-(fp2*f2/2*fp1)));
    if  (abs(hnext-hn)<epsi)
    {

        cout<<"the  root    is"<<hnext;
        return  hnext;
    }
    else    hn=hnext;
}
}




void ortho(double V[SIZEM][SIZEN],double M[SIZEM][SIZEN],double C[SIZEM][SIZEN],int h,int k)
{
    if (V[h+1][k]==-1&&M[h+1][k]==0)
        C[h+1][k]=1;
    if(V[h-1][k]==-1&&M[h-1][k]==0)
        C[h-1][k]=1;
    if (V[h][k+1]==-1&&M[h][k+1]==0)
        C[h][k+1]=1;
    if (V[h][k-1]==-1&&M[h][k-1]==0)
        C[h][k-1]=1;
        return;

}
void inter1(double V[SIZEM][SIZEN],double M[SIZEM][SIZEN],double C[SIZEM][SIZEN],int h,int k)
{ float y=0,z=0; float x=0;
    if(M[h-1][k]==0&&M[h][k+1]==0)
    {
        y=C[h-1][k];  z=C[h][k+1];
        x=root(z,y);
        C[h-1][k+1]=x*z+(1-x)*y+sqrt(pow(x,2)+pow(1-x,2));

    }
else if (M[h-1][k]==0&&M[h][k+1]!=0)
    C[h-1][k+1]=C[h-1][k]+1;
else if (M[h-1][k]!=0&&M[h][k+1]==0)
    C[h-1][k+1]=C[h][k+1]+1;
else cout<<"find solution!"<<endl;
return;
}
void (double V[SIZEM][SIZEN],double M[SIZEM][SIZEN],double C[SIZEM][SIZEN],int h,int k)
{ float l=0,f=0; float x=0;
    if(M[h-1][k]==0&&M[h][k-1]==0)
    {
        l=C[h-1][k];  f=C[h][k-1];
        x=root(f,l);
        C[h-1][k-1]=x*f+(1-x)*l+sqrt(pow(x,2)+pow(1-x,2));

    }
else if (M[h-1][k]==0&&M[h][k-1]!=0)
    C[h-1][k-1]=C[h-1][k]+1;
else if (M[h-1][k]!=0&&M[h][k-1]==0)
    C[h-1][k-1]=C[h][k-1]+1;
else cout<<"find solution!"<<endl;
return;
}

void inter3(double V[SIZEM][SIZEN],double M[SIZEM][SIZEN],double C[SIZEM][SIZEN],int h,int k)
{ float t=0,w=0; float x=0;
    if(M[h][k+1]==0&&M[h+1][k]==0)
    {
        t=C[h][k+1];  w=C[h+1][k];
        x=root(t,w);
        C[h+1][k+1]=x*t+(1-x)*w+sqrt(pow(x,2)+pow(1-x,2));

    }
else if (M[h][k+1]==0&&M[h+1][k]!=0)
    C[h+1][k+1]=C[h][k+1]+1;
else if (M[h][k+1]!=0&&M[h+1][k]==0)
    C[h+1][k+1]=C[h+1][k]+1;
else cout<<"find solution!"<<endl;
return;
}

void inter4(double V[SIZEM][SIZEN],double M[SIZEM][SIZEN],double C[SIZEM][SIZEN],int h,int k)
{ float d=0,e=0; float x=0;
    if(M[h][k-1]==0&&M[h+1][k]==0)
    {
        d=C[h][k-1];  e=C[h+1][k];
        x=root(d,e);
        C[h+1][k-1]=x*d+(1-x)*e+sqrt(pow(x,2)+pow(1-x,2));

    }
else if (M[h][k-1]==0&&M[h+1][k]!=0)
    C[h+1][k-1]=C[h][k-1]+1;
else if (M[h][k-1]!=0&&M[h+1][k]==0)
    C[h+1][k-1]=C[h+1][k]+1;
else cout<<"find solution!"<<endl;
return;
}


void corner(double V[SIZEM][SIZEN],double M[SIZEM][SIZEN],double C[SIZEM][SIZEN],int h,int k)
{
 if (V[h-1][k+1]==-1&&M[h-1][k+1]==0 )
    inter1(V,C,M,h,k);
 if (V[h-1][k-1]==-1&&M[h-1][k-1]==0 )
    inter2(V,C,M,h,k);
 if (V[h+1][k+1]==-1&&M[h+1][k+1]==0 )
    inter3(V,C,M,h,k);
 if (V[h+1][k-1]==-1&&M[h+1][k-1]==0 )
    inter4(V,C,M,h,k);
    return;
}







int main()
{
    int i,j,h=0,k=0;
    for (i=0;i<m;i++)
    {
       for (j=0;j<n;j++)
       {
           C[i][j]=0;
            V[i][j]=-1;
       }
    }
    int M[3][3]={{0,0,1},{0,0,0},{0,0,0}};
    int ag=2; int bg=2;

    for (i=0;i<=ag;i++)
    {
        for (j=0;j<=n-1-bg;j++)
        {
            if (V[ag-i][bg+j]==-1&&M[ag-i][bg+j]==0)
            {
                h=ag-i;  k=bg+j;
                ortho(V,C,M,h,k);
                corner(V,C,M,h,k);
                V[h][k]=1;
            }
        }
    }
     for (i=0;i<=m-1-ag;i++)
    {
        for (j=0;j<=n-1-bg;j++)
        {
            if (V[ag+i][bg+j]==-1&&M[ag+i][bg+j]==0)
            {
                h=ag+i;  k=bg+j;
                ortho(V,C,M,h,k);
                corner(V,C,M,h,k);
                V[h][k]=1;
            }
        }
    }
     for (i=0;i<=ag;i++)
    {
        for (j=0;j<=bg;j++)
        {
            if (V[ag-i][bg-j]==-1&&M[ag-i][bg-j]==0)
            {
                h=ag-i;  k=bg-j;
                ortho(V,C,M,h,k);
                corner(V,C,M,h,k);
                V[h][k]=1;
            }
        }
    }
     for (i=0;i<=m-1-ag;i++)
    {
        for (j=0;j<=bg;j++)
        {
            if (V[ag+i][bg-j]==-1&&M[ag+i][bg-j]==0)
            {
                h=ag+i;  k=bg-j;
                ortho(V,C,M,h,k);
                corner(V,C,M,h,k);
                V[h][k]=1;
            }
        }
    }
    for(i=0;i<4;i++)
    {
        for(j=0;j<4;j++)
        {
            cout<<C[i][j];
        }
    }
}
Line 85 will need a matching prototype.

void (double V[SIZEM][SIZEN],double M[SIZEM][SIZEN],double C[SIZEM][SIZEN],int h,int k);

these go outside the function.

and also name your function....
void someName(double V[SIZEM][SIZEN],double M[SIZEM][SIZEN],double C[SIZEM][SIZEN],int h,int k);

review this quick tutorial on how to pass the arrays and let me know if you need helf putting them into a structure.

http://www.learncpp.com/cpp-tutorial/65-multidimensional-arrays/
Topic archived. No new replies allowed.