# How do I determine the memory offset of a type's field?

**URL:** <https://discourse.julialang.org/t/how-do-i-determine-the-memory-offset-of-a-types-field/16948>\
**Category:** General Usage\
**Created:** [October 30, 2018, 2:34am UTC](https://discourse.julialang.org/t/how-do-i-determine-the-memory-offset-of-a-types-field/16948 "2018-10-30T02:34:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![galenlynch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/galenlynch/32/17947_2.png) [@galenlynch](https://discourse.julialang.org/u/galenlynch)\
**Post date:** [October 30, 2018, 2:34am UTC](https://discourse.julialang.org/t/how-do-i-determine-the-memory-offset-of-a-types-field/16948/1 "2018-10-30T02:34:09Z")

</div>

Let’s say I have a custom composite type:

```julia
struct Foo
    bar::Int
    biz::Float64
end

```

While in this simple case, I can easily calculate the offset of biz myself (8 bytes), is there a function that will do this for me in a more generic way? Something akin to C’s `offsetof` macro?

---

<div class="post-metadata">

**Author:** ![galenlynch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/galenlynch/32/17947_2.png) [@galenlynch](https://discourse.julialang.org/u/galenlynch)\
**Post date:** [October 30, 2018, 2:54am UTC](https://discourse.julialang.org/t/how-do-i-determine-the-memory-offset-of-a-types-field/16948/2 "2018-10-30T02:54:40Z")

</div>

Just found it: `fieldoffset`
