Skip to the task
Layout
Back to classic view

You are looking ahead. Your place is still task 1: Arrays.

CHECKTask 23 of 28 · step 9: Drills: check yourselfColumn by column
Column by column in practice/04/

What do these nested loops print?

Details & hint
int m[2][3] = {{1, 2, 3}, {4, 5, 6}};
for (int c = 0; c < 3; c++) {
    for (int r = 0; r < 2; r++) {
        printf("%d ", m[r][c]);
    }
}

Stuck? 1 4 2 5 3 6: the outer loop goes over the columns, so the array is printed column by column.

practice 04 CMakeLists.txt Code Diff
UNCHANGED This step does not change this file.
add_executable(p04_average main.c)
target_link_libraries(p04_average PRIVATE course_input)