I keep getting strange results with the following program:

------------------------------------------------------------------------------------

#include<stdio.h>
int main ()
{ const dim = 5;
 float a[dim-1][dim-1];
 int i, j;

 /* reset array */
 for (i=0; i<=dim-1; i++)
  for (j=0; j<=dim-1; j++)
   a[i][j]=0;

 /* fill in some data-points */
 a[0][0]=1; a[0][4]=4; a[4][0]=4; a[4][4]=8;

 /* print array */;
 for (i=0; i<=dim-1; i++)
  {   for (j=0; j<=dim-1; j++)
    { printf("[%d][%d]=%1.1f   ",i,j,a[i][j]);
    }
   printf("\n"); }

 return 0; }
------------------------------------------------------------------------------------

When the array position [0][4] is filled, the position [1][0] also gets
filled. This same
problem occurs when filling the [4][0] position. In this case the
previous data position [3][4] gets filled

Tanks in advance, Darius Blaszijk

Reply via email to