# Dereferencing an Array of Struct Pointer

**URL:** https://discourse.julialang.org/t/dereferencing-an-array-of-struct-pointer/51145
**Category:** General Usage
**Tags:** question
**Created:** [December 2, 2020, 8:01pm UTC](https://discourse.julialang.org/t/dereferencing-an-array-of-struct-pointer/51145 "2020-12-02T20:01:01Z")
**Posts on this page:** 1
**Showing post:** 4

<div class="post-metadata">

### Author: ![FedericoStra](https://avatars.discourse-cdn.com/v4/letter/f/76d3ee/32.png) [@FedericoStra](https://discourse.julialang.org/u/FedericoStra)
#### Post date: [December 2, 2020, 8:31pm UTC](https://discourse.julialang.org/t/dereferencing-an-array-of-struct-pointer/51145/4 "2020-12-02T20:31:56Z")

</div>

Uhm… You are right. The reason is that in the array `tests` there are not stored the objects `Test` themselves, but just pointers to them, so there is a double indirection (because they are mutable, which I didn’t notice).

The following works, but seem _extremely fragile_, so there must be a better solution:

```julia
p = Base.unsafe_convert(Ptr{Ptr{Test}}, pointer(tests, 1))
unsafe_load(unsafe_load(p))

```

**Edit**

This works as well and is a bit cleaner:

```julia
p = Base.unsafe_convert(Ptr{Test}, Ref(tests, 1))
unsafe_load(p)

```

---

_[View the full topic](https://discourse.julialang.org/t/dereferencing-an-array-of-struct-pointer/51145)._
