On Tuesday, 4 June 2024 at 12:22:23 UTC, Eric P626 wrote:
~~~
void main()
{  writeln("Maze generation demo");

   s_cell [5][5] maze;
   print_maze (maze);

}

void print_maze ( s_cell [][] maze )
{
}
~~~

This is how to do it without GC allocations (I have used `int` instead for demo purposes):

```d
import std.stdio;
alias s_cell = int;

void main()
{  writeln("Maze generation demo");

   s_cell [5][5] maze = [0, 1, 2, 3, 4];
   s_cell[][5] slices; // static array of 5 slices
   foreach (i, row; maze)
       slices[i] = row;

   print_maze (slices);
}

//~ void print_maze ( s_cell [][] maze... )
void print_maze ( s_cell [][] maze )
{
    foreach (a; maze)
        a.writeln();
}
```

Reply via email to