can any one help to create an dynamic (2*10) two dimensional array using new and delete?
which ask user to enter the value and fill both row and column?
I am able to create one dimensional but unable to create 2-D.

can any one help to create an dynamic (2*10) two dimensional array using new and delete?

Yes I can. It reuires a loop, and the pointer needs two stars, such as int ** array; Lets say you want to create a spreadsheet-like array with 2 rows and 10 columns. The first thing you have to do is allocate the number of rows, like this: array = new int[rows]; Then you start a loop for each row, within that loop allocate the columns for each row

I have created to 2*10 array ..........but i want it to fill the array asking user input. Suppose I want to display like this...
1. 30
2. 50
3. 60
............
not it's address.
please help....

#include <iostream>
using namespace std;
int main(){
    int** ipparray=new int*[10];
//Allocate 2d 2*3array of int.
    for (int i=0;i<10;i++){
        ipparray[i]=new int[2];

    } 
//Fill the array;
    for (int i=0;i<10;i++){

        for (int j=0;j<2;j++){
            cout << "Array[" << i << "][" << j<< "] = " << ipparray[i][j] << endl;
            cin>>ipparray[i][j];
}
    }

    //output the array;
for (int i=0;i<10;i++){
        for (int j=0;j<2;j++){
            cout << "Array[" << i << "][" << j<< "] = " << ipparray[i][j] << endl;
            //cout<<ipparray[i][j]<<"  ";
            //cout<<ipparray[i][j]<<endl;
}
        cout<<endl;
} 
cout<<endl;

//deallocate 
for (int i=0; i<10;i++){
    delete []ipparray[i];
}
delete []ipparray;



  system("pause");
  return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.