Listing 3: Using pointers to arrays to process two-dimensional arrays

void ex3()
{
    int i, j;
    int a[3][3];
    int (*pa)[3] = a;

    for (i = 0; i < 3; ++i)
      for (j = 0; j < 3; ++j)
        pa[i][j] = 1;

    // Save the result of calling f()
    // so the bounds of vla, pvla, and
    // the loop will be consistent
    int bounds = f();
    int vla[3][bounds];
    int (*pvla)[bounds] = vla;

    for (i = 0; i < 3; ++i)
      for (j = 0; j < bounds; ++j)
        pvla[i][j] = 1;
}
— End of Listing —