Let's assume an 8 bit computer with 8 bit addresses (and thus only 256 bytes of memory). This is part of that memory (the numbers at the top are the addresses):

  54   55   56   57   58   59   60   61   62   63   64   65   66   67   68   69
+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
|    | 58 |    |    | 63 |    | 55 |    |    | h  | e  | l  | l  | o  | \0 |    |
+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+

What you can see here, is that at address 63 the string "hello" starts. So in this case, if this is the only occurrence of "hello" in memory then,

const char *c = "hello";

... defines c to be a pointer to the (read-only) string "hello", and thus contains the value 63. c must itself be stored somewhere: in the example above at location 58. Of course we can not only point to characters, but also to other pointers. E.g.:

const char **cp = &c;

Now cp points to c, that is, it contains the address of c (which is 58). We can go even further. Consider:

const char ***cpp = &cp;

Now cpp stores the address of cp. So it has value 55 (based on the example above), and you guessed it: it is itself stored at address 60.


As to why one uses pointers to pointers:

  • The name of an array usually yields the address of its first element. So if the array contains elements of type t, a reference to the array has type t *. Now consider an array of arrays of type t: naturally a reference to this 2D array will have type (t *)* = t **, and is hence a pointer to a pointer.
  • Even though an array of strings sounds one-dimensional, it is in fact two-dimensional, since strings are character arrays. Hence: char **.
  • A function f will need to accept an argument of type t ** if it is to alter a variable of type t *.
  • Many other reasons that are too numerous to list here.
Answer from Stephan202 on Stack Overflow
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ c language โ€บ c-pointer-to-pointer-double-pointer
C - Pointer to Pointer (Double Pointer) - GeeksforGeeks
A double pointer in C is a pointer that stores the address of another pointer. It is also known as a pointer to a pointer because it points to another pointer instead of directly pointing to a variable.
Published: July 18, 2026
๐ŸŒ
W3Schools
w3schools.com โ€บ c โ€บ c_pointer_to_pointer.php
C Pointer to Pointer (Double Pointer)
This is called a pointer to pointer (or "double pointer"). It might sound confusing at first, but it's just one more level of indirection: a pointer that stores the address of another pointer.
Discussions

How do pointer-to-pointers work in C? (and when might you use them?) - Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most. Learn more about Collectives ... Bring the best of human thought and AI automation together at your work. Explore Stack Internal ... Save this question. Show activity on this post. How do pointers-to-pointers ... More on stackoverflow.com
๐ŸŒ stackoverflow.com
What's the use of pointers-to-pointers?
Well a pointer is also data, so it's useful everywhere where having a pointer to data is useful. One usecase I find kinda neat is for linked list algorithms. See https://github.com/mkirchner/linked-list-good-taste More on reddit.com
๐ŸŒ r/C_Programming
32
47
May 11, 2023
Could someone explain advanced pointers "pointer to a pointer," "pointer to a pointer to a pointer?"
A pointer points at something. int i = 42; int *p; p = &i; i is an integer. p is a pointer to an integer. In this case p is pointing at the integer i. If something is a pointer then you have a pointer to a pointer int **q; q is a pointer to a pointer to an integer; q = &p; q is pointing at p. p is pointing at i. A pointer to a pointer is no more advanced than a pointer to an integer. A pointer points at something. That something might be a pointer, it might not. More on reddit.com
๐ŸŒ r/C_Programming
13
5
October 16, 2017
Everything you need to know about pointers in C
"Everything you need to know", yet no mention of aliasing and alignment and related issues (type punning vs strict aliasing). More on reddit.com
๐ŸŒ r/programming
93
130
November 17, 2016
People also ask

How to Use Pointer to Pointer with 2D Arrays in C?
To use a Pointer to Pointer with a 2D array in C, dynamically allocate memory for rows and columns. You can then access each element via double dereferencing: arr[i][j] or *(*arr + i * cols + j).
๐ŸŒ
upgrad.com
upgrad.com โ€บ home โ€บ tutorials โ€บ software & tech โ€บ pointer to pointer in c
Mastering Pointer to Pointer in C: Syntax & Examples
What Are Common Mistakes with Pointer to Pointer in C?
Common mistakes include dereferencing NULL pointers, improper memory allocation, losing track of pointer levels, and not freeing dynamically allocated memory, which can result in crashes, memory leaks, or unexpected behavior in programs.
๐ŸŒ
upgrad.com
upgrad.com โ€บ home โ€บ tutorials โ€บ software & tech โ€บ pointer to pointer in c
Mastering Pointer to Pointer in C: Syntax & Examples
How to Dereference a Pointer to Pointer in C?
To dereference a Pointer to Pointer in C, you use double asterisks (**). First, dereference once to access the address stored in the pointer, and then dereference again to access the data it points to.
๐ŸŒ
upgrad.com
upgrad.com โ€บ home โ€บ tutorials โ€บ software & tech โ€บ pointer to pointer in c
Mastering Pointer to Pointer in C: Syntax & Examples
๐ŸŒ
Reddit
reddit.com โ€บ r/c_programming โ€บ what's the use of pointers-to-pointers?
r/C_Programming on Reddit: What's the use of pointers-to-pointers?
May 11, 2023 -

I already get the idea of plain old pointers to data. All a pointer is is a memory address where some data lives. The plain old pointers are generally used to iterate through things like arrays and tree nodes and to access data on the heap. But where are pointers-to-pointers actually useful (or triple pointers, etc.)? The only places I can think of where they are useful are for multidimentional arrays and navigating through lists of malloc'ed objects. Are there any other use cases where just a regular old pointer wouldn't be enough?

A Basic Guide to Pointers in C Programming Dec 19, 2023
r/programming
2y ago
Code style: Pointers Jun 24, 2025
r/C_Programming
last yr.
Why and when should i use pointers? Feb 3, 2025
r/C_Programming
last yr.
Best Pointers Explanation Dec 15, 2023
r/C_Programming
2y ago
What is the use of pointers in C? Apr 10, 2024
r/C_Programming
2y ago
More results from reddit.com
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ cprogramming โ€บ c_pointer_to_pointer.htm
Pointer to Pointer (Double Pointer) in C
When we define a "pointer to a ... of a pointer, the only difference is that you need to use an additional asterisk (*) before the pointer variable name....
Top answer
1 of 14
416

Let's assume an 8 bit computer with 8 bit addresses (and thus only 256 bytes of memory). This is part of that memory (the numbers at the top are the addresses):

  54   55   56   57   58   59   60   61   62   63   64   65   66   67   68   69
+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+
|    | 58 |    |    | 63 |    | 55 |    |    | h  | e  | l  | l  | o  | \0 |    |
+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+

What you can see here, is that at address 63 the string "hello" starts. So in this case, if this is the only occurrence of "hello" in memory then,

const char *c = "hello";

... defines c to be a pointer to the (read-only) string "hello", and thus contains the value 63. c must itself be stored somewhere: in the example above at location 58. Of course we can not only point to characters, but also to other pointers. E.g.:

const char **cp = &c;

Now cp points to c, that is, it contains the address of c (which is 58). We can go even further. Consider:

const char ***cpp = &cp;

Now cpp stores the address of cp. So it has value 55 (based on the example above), and you guessed it: it is itself stored at address 60.


As to why one uses pointers to pointers:

  • The name of an array usually yields the address of its first element. So if the array contains elements of type t, a reference to the array has type t *. Now consider an array of arrays of type t: naturally a reference to this 2D array will have type (t *)* = t **, and is hence a pointer to a pointer.
  • Even though an array of strings sounds one-dimensional, it is in fact two-dimensional, since strings are character arrays. Hence: char **.
  • A function f will need to accept an argument of type t ** if it is to alter a variable of type t *.
  • Many other reasons that are too numerous to list here.
2 of 14
55

How do pointers to pointers work in C?

First a pointer is a variable, like any other variable, but that holds the address of a variable.

A pointer to a pointer is a variable, like any other variable, but that holds the address of a variable. That variable just happens to be a pointer.

When would you use them?

You can use them when you need to return a pointer to some memory on the heap, but not using the return value.

Example:

int getValueOf5(int *p)
{
  *p = 5;
  return 1;//success
}

int get1024HeapMemory(int **p)
{
  *p = malloc(1024);
  if(*p == 0)
    return -1;//error
  else 
    return 0;//success
}

And you call it like this:

int x;
getValueOf5(&x);//I want to fill the int varaible, so I pass it's address in
//At this point x holds 5

int *p;    
get1024HeapMemory(&p);//I want to fill the int* variable, so I pass it's address in
//At this point p holds a memory address where 1024 bytes of memory is allocated on the heap

There are other uses too, like the main() argument of every C program has a pointer to a pointer for argv, where each element holds an array of chars that are the command line options. You must be careful though when you use pointers of pointers to point to 2 dimensional arrays, it's better to use a pointer to a 2 dimensional array instead.

Why it's dangerous?

void test()
{
  double **a;
  int i1 = sizeof(a[0]);//i1 == 4 == sizeof(double*)

  double matrix[ROWS][COLUMNS];
  int i2 = sizeof(matrix[0]);//i2 == 240 == COLUMNS * sizeof(double)
}

Here is an example of a pointer to a 2 dimensional array done properly:

int (*myPointerTo2DimArray)[ROWS][COLUMNS]

You can't use a pointer to a 2 dimensional array though if you want to support a variable number of elements for the ROWS and COLUMNS. But when you know before hand you would use a 2 dimensional array.

๐ŸŒ
Log2Base2
log2base2.com โ€บ C โ€บ pointer โ€บ pointer-to-pointer-in-c.html
Pointer to pointer in c with example
** declaration indicates that I am a pointer but I am not pointing to a variable rather pointing to the address of another pointer. Assigning an address to the pointer. Accessing the value stored at the pointer. ... /* * Program : Pointer to Pointer * Language : C */ #include<stdio.h> int main() { int a = 10; int *ptr = &a; //ptr references a int **dptr = &ptr; //dptr references ptr printf("Address of a = %p\n",&a); printf("ptr is pointing to the address = %p\n",ptr); printf("dptr is pointing to the address = %p\n",dptr); printf("Value of a = %d\n",a); printf("*ptr = %d\n",*ptr); printf("**dptr = %d\n",**dptr); return 0; }
Find elsewhere
๐ŸŒ
SDSU
edoras.sdsu.edu โ€บ doc โ€บ c โ€บ pointers-1.2.2
Everything you need to know about pointers in C
The pointer has a type, too, by the way. Its type is int. Thus it is an โ€˜int pointerโ€™ (a pointer to int). An int **โ€™s type is int * (it points to a pointer to int). The use of pointers to pointers is called multiple indirection.
๐ŸŒ
Upgrad
upgrad.com โ€บ home โ€บ tutorials โ€บ software & tech โ€บ pointer to pointer in c
Mastering Pointer to Pointer in C: Syntax & Examples
April 30, 2025 - In C programming, a pointer is a variable that stores the address of another variable. Now, imagine a scenario where you need to store the address of a pointer itself. This is where the Pointer to Pointer in C comes into play.
๐ŸŒ
Dot Net Tutorials
dotnettutorials.net โ€บ home โ€บ pointer to pointer in c
Pointer to Pointer in C Language with Examples - Dot Net Tutorials
November 16, 2023 - So, when we define a pointer to a pointer, the first pointer is used to store the address of the variable, and the second pointer is used to store the address of the first pointer.
๐ŸŒ
Scaler
scaler.com โ€บ home โ€บ topics โ€บ c โ€“ pointer to pointer (double pointer)
C โ€“ Pointer to Pointer (Double Pointer) - Scaler Topics
October 10, 2023 - A pointer to pointer in C is used to access or modify the value of a pointer variable. Learn more about double pointer in C with Scaler Topics.
๐ŸŒ
BeginnersBook
beginnersbook.com โ€บ 2014 โ€บ 01 โ€บ c-pointer-to-pointer
C โ€“ Pointer to Pointer (Double Pointer) with example
Letโ€™s understand the concept of double pointers with the help of a diagram: As per the diagram, pr2 is a normal pointer that holds the address of an integer variable num. There is another pointer pr1 in the diagram that holds the address of another pointer pr2, the pointer pr1 here is a pointer-to-pointer (or double pointer).
๐ŸŒ
W3Schools
w3schools.com โ€บ c โ€บ c_pointers.php
C Pointers
In the example above, we used the pointer variable to get the memory address of a variable (used together with the & reference operator). You can also get the value of the variable the pointer points to, by using the * operator (the dereference operator):
๐ŸŒ
Compuhelpindia
compuhelpindia.com โ€บ tutorials โ€บ pointer-to-pointer-in-c.php
Pointer to Pointer in C - Compuhelp Pvt. Ltd
Pointer to pointer means one pointer refers to the address of another pointer. Let's understand this concept through an example:As shown above, a is a variable. It has the memory address 65539 and 65539 is stored at the ptr1 (pointer1). ptr1 has the memory address 65518 which is stored in ptr ...
๐ŸŒ
IncludeHelp
includehelp.com โ€บ c โ€บ pointer-to-pointer-double-pointer.aspx
Pointer to Pointer (Double Pointer) in C programming language
Thus, double pointer (pointer to pointer) is a variable that can store the address of a pointer variable. Read: Pointer Rules in C programming language.
๐ŸŒ
freeCodeCamp
freecodecamp.org โ€บ news โ€บ pointers-in-c-programming
How to Use Pointers in C Programming
May 3, 2023 - For example, to print the value of the integer that p points to, we would write: ... A pointer can also point to another pointer variable. This is known as a "pointer to a pointer".
๐ŸŒ
NxtWave
ccbp.in โ€บ blog โ€บ articles โ€บ pointer-to-pointer-in-c
Understanding Pointer to Pointer in C(Double Pointer)
Learn how pointer to pointer in C works, its usage, and how it helps manage dynamic memory and complex data structures efficiently.
๐ŸŒ
MYCPLUS
mycplus.com โ€บ home โ€บ programming
Double Pointer in C (Pointer to Pointer): Guide + Examples
February 10, 2021 - ... A double pointer (pointer to pointer) is a pointer variable that stores the address of another pointer. Declared with two asterisks โ€” int **pptr; โ€” it adds one more level of indirection: pptr holds the address of a pointer, *pptr gives ...
๐ŸŒ
PREP INSTA
prepinsta.com โ€บ home โ€บ all about c language โ€บ pointer to pointer in c
Pointer to Pointer in C | PrepInsta
March 18, 2026 - Pointer to Pointer in C is defined when the address of the variable is kept in the first pointer.
๐ŸŒ
Programiz
programiz.com โ€บ c-programming โ€บ c-pointers
C Pointers (With Examples)
Initially, the address of c is assigned to the pc pointer using pc = &c;. Since c is 5, *pc gives us 5.
๐ŸŒ
Eskimo
eskimo.com โ€บ ~scs โ€บ cclass โ€บ int โ€บ sx8.html
Chapter 22: Pointers to Pointers
One other aspect of the code deserves mention. The expression ยท (*lpp)->next describes the next pointer of the struct node which is pointed to by *lpp, that is, which is pointed to by the pointer which is pointed to by lpp. The expression ยท lpp = &(*lpp)->next sets lpp to point to the next field of the struct list pointed to by *lpp. In both cases, the parentheses around *lpp are needed because the precedence of * is lower than ->.