An array of pointers and a pointer can be initialized during declaration as illustrated by following examples.
int a[]={0,1,2,3,4};
int *p[]={a,a+1,a+2,a+3,a+4};
int **ptr=p;
Here ‘a’ is an array of integers, ‘p’ is an array of pointers which stores addresses of array elements and ‘ptr’ is a pointer to pointer which stores base address of array ‘p’.
Also Read
- Static and Dynamic Memory Allocation
- Memory Leak and Dangling Pointer
- Memory Allocation for 2D Array
- Dynamic Memory Allocation
- Pointer Constant and Constant Pointer
- Pointer Declarations and their Meanings
- Functions and Pointers
- Pointer to Pointer Multiple Indirection
- Relationship between Arrays and Pointers
- Pointer to Array
- Pointer Arithmetic
- Types of Pointers
- Illustrate Basic Pointer Use
- Using Pointer
- Intializing Pointer
- Declaring Pointer
- Application of Pointers
- Value Model VS Reference Model
- What is Pointer
Comments
Post a Comment
Please give us feedback through comments