How to allocate 2-dimension array for the int *p; in C++ using new.

Showing Answers 1 - 2 of 2 Answers

Babu j

  • Dec 11th, 2006
 

For creating [2]5] integer pointer

int ** p; 

p= new int*[2]; 

p[0] = new int[5];

p[1] = new int[5];

  Was this answer useful?  Yes

Mani

  • Sep 24th, 2007
 

int **p;
p=new int*[3];
for(int i=0;i<3;i++)
p[i]=new int[3];

Its equal to a[3][3] declaration

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions