C-Quiz: 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.

Mittel 10 Fragen ~6 Minuten Bestanden ab 80% C17

Modus wählen

Du spielst als Gast: Melde dich an, damit XP und Serie gespeichert werden.

Beispielfrage

Frage 1 von 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;
}
Lösung zeigen

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.

Darum geht es in diesem 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

Häufige Fragen

Brauche ich ein Konto?

Nein. Jeder kann spielen. Mit Anmeldung werden XP, Serie, Abzeichen und Verlauf gespeichert.

Kann ich es wiederholen?

Ja. Dein Bestwert bleibt erhalten, und Fragen und Antworten werden jedes Mal neu gemischt.