C-Quiz: Pointer Basics

This C quiz checks the first ideas about pointers - what & and * do, how a pointer lets a function change the caller's variable and why NULL must be checked. It is for learners who have just met pointers and want to make them click.

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

B. 8 p holds the address of x, so *p = 8 writes 8 into x itself. There is only one integer here, reached under two names.

Darum geht es in diesem Quiz

  • &x gives an address, *p follows it
  • Changing a variable through a pointer
  • Passing pointers so a function can modify its arguments
  • Comparing pointers vs comparing the values they point to
  • NULL and the int* a, b trap

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.