What does ‘**’ mean in C?

In a declaration, it means it’s a pointer to a pointer:

int **x;  // declare x as a pointer to a pointer to an int

When using it, it deferences it twice:

int x = 1;
int *y = &x;  // declare y as a pointer to x
int **z = &y;  // declare z as a pointer to y
**z = 2;  // sets the thing pointed to (the thing pointed to by z) to 2
          // i.e., sets x to 2

Leave a Comment