Explain solidity>arrays

Arrays

Arrays in Solidity:

Arrays store multiple values of the same type. There are two kinds:

• Dynamic: uint[] numbers; (size can change)

• Fixed: uint[5] numbers; (always has exactly 5 elements)

Our Tic Tac Toe Board:

A Tic Tac Toe board has 9 squares (3×3 grid). We'll represent it as a one-dimensional array with 9 positions (0-8):

[0] [1] [2]
[3] [4] [5]
[6] [7] [8]

Creating the Board:

Cell[9] public board;

Cell[9] means an array of exactly 9 Cell values

public lets anyone read the board state

board is the variable name

All squares start as Cell.Empty by default! This is because in Solidity, enum values are initialized to the first option (index 0), which is Cell.Empty in our case.

Your task: Add the board array to store the game state.

Add board array
0%
Requirements:
Array has exactly 9 cells
Marked as public
Add the name of the variable