Curious problem with multidimensional array

 

I had a very curious problem with a multidimensional array which I just can't figure out. I first made an array like this:

double MyArray[][2];

So I had an array consisting of dimensions with 2 items in the second dimension, both of which I used for some calculations in my code. I then looked at the output on my screen and so far all was good. But then I decided to add two extra items, so I got this:

double MyArray[][4];

When I checked the output of this I saw that it was different. And the strange part of this is that I did not use these last 2 items for anything in my script! I had literally only changed double MyArray[][2]; to double MyArray[][4]; and somehow this resulted in a different output. Can anyone explain me how this is even possible, because I just can' get my head around this one.

 
Ade Bijon:

I had a very curious problem with a multidimensional array which I just can't figure out. I first made an array like this:

double MyArray[][2];

So I had an array consisting of dimensions with 2 items in the second dimension, both of which I used for some calculations in my code. I then looked at the output on my screen and so far all was good. But then I decided to add two extra items, so I got this:

double MyArray[][4];

When I checked the output of this I saw that it was different. And the strange part of this is that I did not use these last 2 items for anything in my script! I had literally only changed double MyArray[][2]; to double MyArray[][4]; and somehow this resulted in a different output. Can anyone explain me how this is even possible, because I just can' get my head around this one.

Can you copy paste the output please ? 

 
  1. Do you really expect an answer? We can't see your broken code. There are no mind readers here and our crystal balls are cracked.
  2. You probably shouldn't be using a 2D array but a 1D array of a structure.