Professional Documents
Culture Documents
ASD Course - Chap9 - Pointer To Pointer (Double Pointer) in C
ASD Course - Chap9 - Pointer To Pointer (Double Pointer) in C
Chapter 9: C pointers
In previous two parts of the this chpter, we learned basics of pointers. We learned
to create pointers and how to perform arithmetic operations on them.
We learned to create pointers to int and char. In real, you can have pointer to any
type in C. You can have a pointer to int, char, float, double, structure, array or
even pointer. In fact, you can declare pointer to pointer to pointer to pointer. That
looks complex. For now, let us focus on pointer to pointer.
In the above image pointer *ptr points at memory location 0x1230 of integer type.
Pointer **dPtr points at memory location 0x1220 of integer pointer type.
Note: Pointer to pointer will always store address of a pointer of same type.
/**
* C program to demonstrate use of pointer to a pointer
*/
#include <stdio.h>
int main()
{
int num; // Integer variable
3
Algorithmic and DYNAMIC data structure Chapter 9: C pointers
return 0;
}
Output –
Value of num = 10
Value pointed by ptr = 10
Value pointed by dPtr = 10