I am making a game board through a 2D char array and I want it to be a global array. I’ve done this in Java, where I’ve declared it as:
static char[][] gameboard; //Gameboard array
But it is not working in C#. I’m new to C# and I don’t know why the compiler wont accept.
const char[,] gameBoard;
I tried to make the value of it null, but it doesn’t let my program run.
C# doesn’t support global variables outside of type definitions. So you would need to write something like this:
You would then access gameBoard with
Gameboard.gameBoard.