Skip to main content
Engineering LibreTexts

2.8: Pointers to Pointers

  • Page ID
    34653
  • In C++, we can create a pointer to a pointer that in turn may point to data or other pointer. The syntax simply requires the unary operator (*) for each level of indirection while declaring the pointer.

    char a;

    char *b;

    char ** c;

    a = ’g’;

    b = &a;

    c = &b;

    Here b points to a char that stores ‘g’ and c points to the pointer b.

    Adapted from:
    "Pointers in C/C++ with Examples" by Abhirav Kariya, Geeks for Geeks is licensed under CC BY 4.0

    • Was this article helpful?