Hello!
In my program, I have defined a struct called `Tile` in the global scope. In my `main()` function I create a 3d array of `Tile`s called `board`. I then have a function called `loopBoard()` that loops through certain parts of `board`. I then create a reference to the `Tile` struct at the current position of `board`. This all works until I try to de-reference that pointer. The result compiles, but I get the exit code `-1073741819` whenever I run it. Below is the function in question. Do any of you have literally any clue about where I'm screwing up?

```d
void loopBoard(Tile[8][8][8]* board, void function(int, int, int, Tile*) func){
        for(int number = 7; number >= 0; number--){
                writeln(number);
                for(int symbol = 7 - number; symbol < 8; symbol++) {
                        writeln("  " ~ to!string(symbol));
                        //((x % y) + y) % y to make modulo work as expected
                        int letter = (((symbol - 7) % 7) + 7) % 7;
                        if(letter == 0 && symbol != 0)
                                letter += 7;

                        int[2] lArr;
                        lArr[0] = letter;
                        lArr[1] = (letter != 7) ? letter + 1 : -1;
writeln(" [" ~ to!string(lArr[0]) ~", " ~ to!string(lArr[1]) ~ "]");

                        for(int i = 0; i < lArr.length; i++){
                                
                                Tile * tile = (board[number][symbol][i]).ptr;

                                //program runs well until I reach this point, 
then it crashes
                                writeln("\t", *tile);
                                func(number,symbol,lArr[i], tile);
                        }

                        
                }
        }
}
```

Reply via email to