Programming C: Make a 2-D array to represent a Tic-Tac-Toe game/grid. Place a couple of 'X's and 'O's in the grid and display it.
If it's a 3x3 Tic-Tac-Toe board, the array is also going to be 3x3. You're putting chars in there ('X' and 'O' are chars), so it's going to contain chars. The declaration should look something like this: char ttt[3][3]; Once you've got that, you've declared your 2d array. Now you've got to put some X's and O's in there. For me, it's easiest to think of the array like a coordinate plane, but don't forget that the first index starts at zero! If it helps, you can draw a chart labeling all of the squares with their "coordinates". Pick a couple squares, then add them to the array like this (don't forget single quotation marks!): ttt[1][2] = 'X'; Hope this helps! I've only been doing C for a few months now, but I believe that is correct!
Join our real-time social learning platform and learn together with your friends!