twittidai / picoc

Automatically exported from code.google.com/p/picoc
0 stars 0 forks source link

Multiple index arrays don't work #80

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
int a[4][4];
int b = 0;
int x;
int y;

for (x = 0; x < 4; x++)
{
    for (y = 0; y < 4; y++)
    {
        b++;
        a[x][y] = b;
    }
}

for (x = 0; x < 4; x++)
{
    printf("x=%d: ", x);
    for (y = 0; y < 4; y++)
    {
        printf("%d ", a[x][y]);
    }
    printf("\n");
}

-----------------------
Observed output:
x=0: 13 14 15 16 
x=1: 13 14 15 16 
x=2: 13 14 15 16 
x=3: 13 14 15 16 

-----------------------
Expected output:
x=0: 1 2 3 4
x=1: 5 6 7 8
x=2: 9 10 11 12
x=3: 13 14 15 16 

Original issue reported on code.google.com by zik.sale...@gmail.com on 4 Jun 2010 at 4:17

GoogleCodeExporter commented 8 years ago
Fixed in revision #419

Original comment by zik.sale...@gmail.com on 5 Jun 2010 at 12:59