I am trying to initialize a 2D array to create a map that will print out stars at the beginning of the program. I have my initialization in a function. Whenever I try to run the program, I get crazy numbers. Any tips on how to make this 2D array correct? This is my code and the result that I get:
void InitializeArray() { char map[Y_DIM][X_DIM]; for (int row = 0; row < Y_DIM; row++) { for (int col = 0; col < X_DIM; col++) { cout << map[row][col]; cout << "*"; } cout << endl; } } This is my result
`*2*.*v*/*************** ****************** ?*?*?*u*/****?*?*?*?*?*?*?*?*?*!*`** ****?*!*`******?*!*`****** ?*-*?**?****U*?*7*v*/****?**@** ****?*?*7*v*/*****E*]*v*/**** ?*!*`*******-*?**?****?*!*`** ****?**@******p* *@****** ?*-*?**?**************** ****?*?*7*v*/****p* *@******