1. ## strange array issue

I have a class that contains coordinates for a square.
I set the values, and then right afterwards, I try to access them ,and every index is the same as the last one!
Anyone know why this is?
Code:
```	tile block[3][3];
for (p=0;p<3;p++)
{
for (i=0;i<3;i++)
{
block[i][p].setX(curX);
block[i][p].setY(curY);
block[i][p].setWidth(TWidth);
block[i][p].setHeight(THeight);
printf("%d %d %d %d \n", block[0][0].getX(),block[0][0].getY(),block[0][0].getWidth(),block[0][0].getHeight());
curX = curX+TWidth+20;
}
curX=50;
curY= curY+THeight+10;
}
printf("%f %f %f",block[0][0].getRf(),block[0][0].getGf(),block[0][0].getBf());

for (p=0;p<3;p++)
{
for (i=0;i<3;i++)
{

printf("%d %d %d %d \n", block[i][p].getX(),block[i][p].getY(),block[i][p].getWidth(),block[i][p].getHeight());
printf("\n");
}

}```
and the output
50 50 50 50
120 50 50 50
190 50 50 50
50 110 50 50
120 110 50 50
190 110 50 50
50 170 50 50
120 170 50 50
190 170 50 50
1.000000 0.000000 0.000000190 170 50 50

**
*******Right here is where it starts outputting the numbers again after the loop
**
190 170 50 50

190 170 50 50

190 170 50 50

190 170 50 50

190 170 50 50

190 170 50 50

190 170 50 50

190 170 50 50

2. Perhaps you should change the ints p & i to another assigned letter in your second for loop. Does it reset p & i back to zero?

3. yeah they reset to zero in the for loop initialization

4. I would think it would be the opposite. The printf in the first for loop only accesses element 0,0, the second loop looks fine.

5. look at the Output, tile[0][0] is different every time :S

and For( int whatever=0;**;i++) resets back to zero

6. You don't happen to be declaring the X, Y, Width, and Height members of the tile class as "static," are you?

7. > printf("&#37;d %d %d %d \n", block[0][0].getX()
How come you're getting changing numbers, when you keep printing the [0][0] element?

I think your class is doing something else. Post the class and those member functions as well.