Listing 2: Using pointers to int to process arrays of int

void ex2()
{
    int i;
    int a[3];
    int *p1 = a;

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

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

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