I need help with filling up a char array in c++ with a letter and without using a loop. This is what i have so far.
int n, m;
cin >> n >> m;
char canvas[n][m] = {{'B'}};
This however won't work. Does anyone know how I can do this?
I need help with filling up a char array in c++ with a letter and without using a loop. This is what i have so far.
int n, m;
cin >> n >> m;
char canvas[n][m] = {{'B'}};
This however won't work. Does anyone know how I can do this?
You can do this pretty easily with a 2D std::vector
:
int n, m;
std::cin >> n >> m;
std::vector<std::vector<char>> canvas(n, std::vector<char>(m, 'B'));