I'm new to using pointers and I have a problem. I must get a 2D array of characters from the user and the user is giving me the number of rows and columns and what the array should be filled with.
I wrote the code below for it but it doesn't work.I tried searching for such thing but I didn't find anything. can you help me to fix the error with this code please?
1 2 3 4 5 6 7 8 9 10 11 12
int rows,col,i,j;
char **array;
int *storage;
cin >> rows >> col;
array = new *int[rows];
storage = newint[rows*col];
for (int i = 0; i < rows; ++i)
array[i] = storage + col * i;
for(i=0;i<rows;i++){
for(j=0;j<col;j++){
cin>>array[i][j];}
}