C Pointer to Pointer Quiz

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.

Hard 10 questions ~8 minutes Pass at 80% C17

Choose a mode

Playing as a guest: sign in to keep your XP and streak.

Sample question

Question 1 of 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;
}
Show the answer

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.

What this quiz covers

  • 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

Questions people ask

Do I need an account?

No. Anyone can play. Sign in to keep your XP, streak, badges and history.

Can I retake it?

Yes. Your best score is kept, and the questions and answers are shuffled each time.