How to pass in reference a fixed array in parameter
Kagamin
spam at here.lot
Wed Jun 5 09:38:03 UTC 2024
With accessor:
```
void main()
{
s_cell[] maze=make(5,5);
s_cell a=maze.get(1,2);
print_maze(maze);
}
void print_maze(s_cell[] maze)
{
}
s_cell[] make(int width, int height)
{
return new s_cell[width*height];
}
s_cell get(s_cell[] maze, int x, int y)
{
return maze[5*y+x]; //oops
}
```
looks like you need to store the maze width somewhere.
More information about the Digitalmars-d-learn
mailing list