# How to examine a pointer address?

**URL:** <https://discourse.julialang.org/t/how-to-examine-a-pointer-address/101791>\
**Category:** General Usage\
**Tags:** c\
**Created:** [July 19, 2023, 4:55pm UTC](https://discourse.julialang.org/t/how-to-examine-a-pointer-address/101791 "2023-07-19T16:55:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![frylock](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frylock/32/50213_2.png) [@frylock](https://discourse.julialang.org/u/frylock)\
**Post date:** [July 19, 2023, 4:55pm UTC](https://discourse.julialang.org/t/how-to-examine-a-pointer-address/101791/1 "2023-07-19T16:55:08Z")

</div>

I am wrapping a library that returns an opaque structure. The call that gives me my result looks like:

```julia
 z = @ccall mylib.returns_opaque()::Ptr{Cvoid}

```

If the structure is properly initialized, it will be nonzero (i.e. not NULL). If it is likely that it is initialized, I’ll get something back like this:

```julia
Ptr{Nothing} @0x0000561f9dd53790

```

If it didn’t work, something like this:

```julia
Ptr{Nothing} @0x0000000000000000

```

How can I differentiate between the two? There don’t seem to be any fields for `Ptr`?

```julia
julia> z
Ptr{Nothing} @0x0000000000000000

julia> z == 0
false

julia> fieldnames(typeof(z))
()

```

---

<div class="post-metadata">

**Author:** ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)\
**Post date:** [July 19, 2023, 5:03pm UTC](https://discourse.julialang.org/t/how-to-examine-a-pointer-address/101791/2 "2023-07-19T17:03:04Z")

</div>

Compare with `C_NULL`, which is the C null pointer.

---

<div class="post-metadata">

**Author:** ![frylock](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frylock/32/50213_2.png) [@frylock](https://discourse.julialang.org/u/frylock)\
**Post date:** [July 19, 2023, 5:11pm UTC](https://discourse.julialang.org/t/how-to-examine-a-pointer-address/101791/3 "2023-07-19T17:11:29Z")

</div>

On re-examination of the [calling C and Fortran](https://docs.julialang.org/en/v1/manual/calling-c-and-fortran-code/) page, I do sort-of see it mentioned in there. Sadly things have to be rather explicit for me to pick it up the first time around.
