Recover an array from its loop

Without running the program, write all six array values immediately after initialization. Then show the array after each loop iteration and give the exact output. Explain why the last three initial values are known even though the array is local. Name the first and last valid subscripts.

#include <stdio.h>
int main(void) {
    int a[6] = {4, 1, 7};
    for (int i = 1; i < 6; ++i) {
        a[i] += a[i - 1];
    }
    for (int i = 0; i < 6; ++i) {
        printf("%s%d", i == 0 ? "" : " ", a[i]);
    }
    putchar('\n');
    return 0;
}

