Home > Back-end >  How to define the pointer to the pointer array (malloc space)?
How to define the pointer to the pointer array (malloc space)?

Time:09-27

Such as
Int * p=(int *) malloc (sizeof (int));

P is pointing to the array of type int,

Int * p [10]; Such an array of

How to define a pointer p, how malloc a return address space for p,

CodePudding user response:

Int * * p=(int) * * malloc (sizeof (int *));

CodePudding user response:

If upstairs,
Strong or smart, turn can also
Int * * p=(int) * * malloc (sizeof (int));//malloc nature is only apply for a certain size of the space

CodePudding user response:

refer to the second floor response: thousand dreams life
if upstairs,
Strong or smart, turn can also
Int * * p=(int) * * malloc (sizeof (int));//malloc nature is only apply for a space the size of

And return the first byte address space

CodePudding user response:

 int * p [10]; 
P=(int) * * malloc (sizeof (int *) * 10);
if (! P)
exit(0);
For (I=0; i <10; I++)
P=(int *) [I] malloc (sizeof (int) * 20);

  • Related