Why does my Visual Studio not show the 2nd dimension of a 2D array while debugging my c program?
I’m practicing c with my nephew using visual studio. We both have the same code:
void main()
{
char board[3][3] =
{
{ 'X', ' ', ' ' },
{ ' ', 'X', ' ' },
{ ' ', ' ', 'X' }
};
}
While debugging, we are watching the board variable. His v.s. shows all 9 elements of the board when fully expanded in the watchlist. Mine only shows 3 pointers / the first element of each row which can’t be expanded. How can i fix this?
As a temporary solution, i stored the rows in variables like this to be able to watch them.
char r0[3];
for (int i = 0; i < 3; i++)
{
r0[i] = board[0][i];
}
//...
Read more here: Source link
