Home > other >  2 how to initialize the pointer array
2 how to initialize the pointer array

Time:10-18

Int * * parray [10], how to initialize the parray?

CodePudding user response:

Int * * parray [10], how to initialize the parray?
This is a level 3 Pointers, arrays nature is also a pointer

The secondary pointer:
Int * parray [10].
for(int i=0; i<10; I++)
{
Parray [I]=new int.
}

CodePudding user response:

Deposited in the nature or array, the array is the secondary pointer, so like normal array can be initialized,

CodePudding user response:

1/f, explanation is not clear,
First you have to understand what is the secondary pointer concept, pointer to a pointer, so it is essentially a pointer and pointer to content is a level 1,
So you can be initialized to NULL pointer (essentially)

Or similar to the pointer to a level below,
Int * p1=& amp; a;
Int * * p2=& amp; P1.


* (* p2) for a;

Array, just a collection of multiple elements,

CodePudding user response:

refer to the second floor ykun089 response:
essence or array, the array is stored in the secondary pointer, so like normal array can be initialized,


int data;
Int * pData=https://bbs.csdn.net/topics/&data;
Int * * ppData=https://bbs.csdn.net/topics/&pData;

Int * * parray [10].
Parray [0]=ppData;/* will deposit a secondary pointer variable to the secondary pointer variable in the zeroth element of an array of */

Please remember, what type of array put what types of elements,

CodePudding user response:

This is an array, each element is a pointer to a pointer
  • Related