Free tutorials in Hindi & English Daily computer, mobile and IT guides Beginner friendly learning
Blog · C Pointers · 03 Jul 2026 · Hindi + English

Double Pointer in C (Pointer to Pointer) Explained Simply

A double pointer (int **p) stores the address of another pointer. Understand the two-level dereference with a simple diagram-style example.

What is a double pointer?

A double pointer (pointer to pointer) is a pointer that stores the address of another pointer. Declared with two stars: int **pp;
int   x  = 10;
int  *p  = &x;    /* p  holds address of x  */
int **pp = &p;    /* pp holds address of p  */

Chain picture: pp → p → x. Follow one arrow with one star: *pp gives p, **pp gives x.

The three levels of access

#include <stdio.h>

int main() {
    int x = 10;
    int *p = &x;
    int **pp = &p;

    printf("x    = %d\n", x);      /* direct       */
    printf("*p   = %d\n", *p);     /* one jump     */
    printf("**pp = %d\n", **pp);   /* two jumps    */

    **pp = 50;                     /* change x through 2 levels */
    printf("x    = %d\n", x);
    return 0;
}
x = 10 *p = 10 **pp = 10 x = 50

Reading table (memorize this)

ExpressionGivesMeaning
ppAddress of pValue stored in pp
*ppp (address of x)One dereference
**pp10 (value of x)Two dereferences

Real use 1: Modifying a pointer inside a function

#include <stdio.h>
#include <stdlib.h>

void allocate(int **pp) {        /* receives ADDRESS of a pointer */
    *pp = (int*)malloc(sizeof(int));
    **pp = 99;
}

int main() {
    int *p = NULL;
    allocate(&p);                /* pass address of p             */
    printf("Allocated value: %d\n", *p);
    free(p);
    return 0;
}
Allocated value: 99
This is the classic reason double pointers exist: a function can change where the caller's pointer points only if it receives the pointer's address. With a single pointer parameter, the function would modify a copy. The same pattern appears everywhere in linked lists: void insert(struct Node **head, ...).

Real use 2: main's argv

int main(int argc, char **argv)   /* argv is a double pointer:      */
                                  /* pointer to array of char*      */

char **argv is an array of string pointers — argv[0] is the program name, argv[1] the first argument. Every C programmer uses a double pointer here, often without realizing it.

Double pointer क्या है?

Double pointer (pointer to pointer) वह pointer है जो दूसरे pointer का address store करता है. दो stars से declare होता है: int **pp;
int   x  = 10;
int  *p  = &x;    /* p  में x का address   */
int **pp = &p;    /* pp में p का address   */

Chain picture: pp → p → x. एक star = एक arrow follow करना: *pp देता है p, **pp देता है x.

Access के तीन levels

#include <stdio.h>

int main() {
    int x = 10;
    int *p = &x;
    int **pp = &p;

    printf("x    = %d\n", x);      /* direct     */
    printf("*p   = %d\n", *p);     /* एक jump    */
    printf("**pp = %d\n", **pp);   /* दो jumps   */

    **pp = 50;                     /* 2 levels से x बदलें */
    printf("x    = %d\n", x);
    return 0;
}
x = 10 *p = 10 **pp = 10 x = 50

Reading table (याद कर लें)

Expressionदेता हैमतलब
ppp का addresspp में stored value
*ppp (x का address)एक dereference
**pp10 (x की value)दो dereferences

Real use 1: Function के अंदर pointer modify करना

#include <stdio.h>
#include <stdlib.h>

void allocate(int **pp) {        /* pointer का ADDRESS receive करता है */
    *pp = (int*)malloc(sizeof(int));
    **pp = 99;
}

int main() {
    int *p = NULL;
    allocate(&p);                /* p का address pass करें             */
    printf("Allocated value: %d\n", *p);
    free(p);
    return 0;
}
Allocated value: 99
Double pointers के होने की यही classic वजह है: function caller के pointer को कहां point करे यह तभी बदल सकता है जब उसे pointer का address मिले. Single pointer parameter में function सिर्फ copy modify करता. यही pattern linked lists में हर जगह दिखता है: void insert(struct Node **head, ...).

Real use 2: main का argv

int main(int argc, char **argv)   /* argv double pointer है:        */
                                  /* char* के array का pointer      */

char **argv string pointers का array है — argv[0] program का नाम, argv[1] पहला argument. हर C programmer यहां double pointer use करता है, अक्सर बिना जाने.

Frequently Asked Questions

What is a double pointer in C?

A double pointer (int **pp) is a pointer that stores the address of another pointer, so **pp reaches the final value through two dereferences.

Why do linked list functions take struct Node **head?

Because inserting at the front must change where head points; only receiving the address of head lets the function modify the caller's actual head pointer.

What is char **argv in main?

argv is a pointer to an array of character pointers: each argv[i] is a string, with argv[0] being the program name.