char double array


If I write

4 5
asdgw
asdgj
whoiw
qwhno

stuff like this, I have to make char double array with those letters.

1
2
3
4
5
6
7
8
9
10
11
  int row, column, count;
  cin >> row;
  cin >> column;
  char input[row][column+1];

  while(row>0)
  {
    cin >> input[count];
    count++;
    row--;
  }


But this doesn't work. I don't know why. please help meeeeeeeeeeeeeeee
1. VLA. Variable lenght arrays. C++11 does not have them. Line 4 is thus an error. There is dynamic allocation to solve this.

2. >> to char* See: http://www.cplusplus.com/reference/istream/istream/operator-free/
"a null char is appended"
You type "asdgw". That occupies input[0][0-4]. A null is placed to input[0][5]. That is same as input[1][0]. The next input overwrites the null.

Use std::string instead of array, or read in single characters.
How can I read single characters when they are written in that way???
There was a link in my previous post.
Topic archived. No new replies allowed.