C-Quiz: Pointer to Pointer

This C quiz goes one level deeper: pointers that point to other pointers. It checks the patterns where ** is really needed, such as functions that must change the caller's pointer, out-parameters for allocated memory and arrays of strings, plus the type traps around 2D arrays.

Schwer 10 Fragen ~8 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 x = 5;
    int *p = &x;
    int **pp = &p;
    **pp = 9;
    printf("%d %d\n", x, *p);
    return 0;
}
Lösung zeigen

C. 9 9 *pp is p, and **pp is what p points to, which is x. Writing 9 there changes x, and reading *p sees the same variable.

Darum geht es in diesem Quiz

  • Reading *pp and **pp
  • Changing the caller's pointer from a function
  • Returning allocated memory through an out-parameter
  • Arrays of strings like argv
  • Why int ** is not a 2D array

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.