getting a 2d array with pointer
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?
cin >> rows >> col;
array = new *int[rows];
storage = new int[rows*col];
for (int i = 0; i < rows; ++i)
array[i] = storage + col * i;
Last edited on
|I must get a 2D array of characters from the user|
Then why do you have
at lines 3, 5 and 6?
Line 5 has the asterisk misplaced. It should be
should really be
Topic archived. No new replies allowed.