Tsallaka zuwa abun ciki
Justice Tech School

Pointers to Pointers and const

A pointer can point to another pointer. const can protect the data, the pointer or both. NULL means a pointer that points nowhere.

Example
int x = 5; int *p = &x; int **pp = &p;
**pp = 9;
printf("%d\n", x);
const int *cp = &x;
int *const fp = &x;
printf("%d %d\n", *cp, *fp);
int *n = NULL;
printf("%d\n", n == NULL);

Result

9
9 9
1

Exercise

Address-of operator.

int *p = x;

Quiz Test

What does int **pp hold?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.