Quiz di C: 2D Arrays

This C quiz is about arrays of arrays, the usual way to store grids and matrices. It checks indexing with two subscripts, how initializers fill rows, how sizeof sees rows and columns, and how to pass a 2D array to a function.

Medio 10 domande ~6 minuti Superato con il 80% C17

Scegli una modalità

Stai giocando come ospite: accedi per salvare XP e serie.

Domanda di esempio

Domanda 1 di 10

What does this print?

#include <stdio.h>

int main(void) {
    int m[2][3] = {{1, 2, 3}, {4, 5, 6}};
    printf("%d %d\n", m[1][2], m[0][1]);
    return 0;
}
Mostra la risposta

A. 6 2 The first index picks the row and the second the column, both from 0. m[1][2] is the last item of the second row, 6, and m[0][1] is the middle of the first row, 2.

Cosa copre questo quiz

  • m[row][col] indexing and nested loops
  • Row-by-row initializers and the zero fill
  • Counting rows and columns with sizeof
  • Which dimension can be left out
  • Row-major layout and function parameters

Domande frequenti

Serve un account?

No. Chiunque può giocare. Accedi per salvare XP, serie, badge e cronologia.

Posso rifarlo?

Sì. Il tuo miglior punteggio resta salvato, e domande e risposte vengono mescolate ogni volta.