Ok this is very strange and i cannot see where is the problem and i guess is really easy but i cannot see it so i will need your help :-O
My Declarations
int myGraph[4][4];
int vertices[4];
char path[4];
My initialize code
for(int i=0; i<=4;i++)
{
for(int z=0; z<=4; z++)
myGraph[i][z] = -1;
}
for(int y=0; y<=4;y++)
{
vertices[y] = 9999;
path[y] = 's';
}
myGraph[0][1] = 7;
myGraph[0][3] = 2;
myGraph[1][2] = 1;
myGraph[1][3] = 3;
myGraph[2][4] = 4;
myGraph[3][1] = 2;
myGraph[3][2] = 8;
myGraph[3][4] = 5;
myGraph[4][2] = 5;
vertices[0] = 0;
Can anyone please tell me if i have done something wrong in this code??????
Because strangely the program is initialize myGraph to -1 and also the array vertices to -1 :S How is that possible?
How it confuse the two arrays? They have different name but same size is that a problem?
(I have seen the previous operations while debugging using a watch)
Screenshot:
[img]http://img254.imageshack.us/img254/2216/untitleg.jpg[/img]
Now because the vrtices are reinitialized after the initialization of myGraph the get the value 9999 correctly BUT when i reach line myGraph[3][4] = 5; then the vertice array change to 5 :S
Screenshot
[img]http://img262.imageshack.us/img262/9552/42388498.png[/img]
Is driving me crazy and if the solution is obvious i cannot see it ...:S