Issue De-referencing a Pointer to a Struct in an Array

Pen Hall aidencbernstein at gmail.com
Fri Jul 14 17:14:01 UTC 2023


On Friday, 14 July 2023 at 16:57:33 UTC, Pen Hall wrote:
> 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?
>
> [...]

I realized a slight issue with this code is that 
`board[number][symbol][i]` refers to an array... somehow. I 
genuinely have no idea as to why this is.


More information about the Digitalmars-d-learn mailing list