# Dereference a pointer

**URL:** <https://discourse.julialang.org/t/dereference-a-pointer/6251>\
**Category:** General Usage\
**Created:** [October 4, 2017, 8:36pm UTC](https://discourse.julialang.org/t/dereference-a-pointer/6251 "2017-10-04T20:36:48Z")\
**Posts on this page:** 6\
**Page:** 2

<div class="post-metadata">

**Author:** ![Frank\_Applin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frank_applin/32/1654_2.png) [@Frank\_Applin](https://discourse.julialang.org/u/Frank_Applin)\
**Post date:** [October 5, 2017, 9:14pm UTC](https://discourse.julialang.org/t/dereference-a-pointer/6251/21 "2017-10-05T21:14:26Z")

</div>

This is hopefully the last question on this topic. In C, arrays are zero based and in Julia they are 1 based. Is that going to make a difference when getting values back in a buffer (i.e. Vector) from these ccall function calls?

---

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [October 5, 2017, 9:23pm UTC](https://discourse.julialang.org/t/dereference-a-pointer/6251/22 "2017-10-05T21:23:20Z")

</div>

You need to use the correct syntax on both side to access a specific element but other than that the difference between the two language does not affect how you write the interface code.

---

<div class="post-metadata">

**Author:** ![Frank\_Applin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frank_applin/32/1654_2.png) [@Frank\_Applin](https://discourse.julialang.org/u/Frank_Applin)\
**Post date:** [October 5, 2017, 9:29pm UTC](https://discourse.julialang.org/t/dereference-a-pointer/6251/23 "2017-10-05T21:29:48Z")

</div>

OK. I just wanted to double check.

---

<div class="post-metadata">

**Author:** ![simonbyrne](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/simonbyrne/32/19_2.png) [@simonbyrne](https://discourse.julialang.org/u/simonbyrne)\
**Post date:** [October 5, 2017, 11:15pm UTC](https://discourse.julialang.org/t/dereference-a-pointer/6251/24 "2017-10-05T23:15:21Z")

</div>

Can you post the code for this? I’ve been meaning to do this to get the accelerometer working for [SenseHat.jl](https://github.com/JuliaBerry/SenseHat.jl).

---

<div class="post-metadata">

**Author:** ![Frank\_Applin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frank_applin/32/1654_2.png) [@Frank\_Applin](https://discourse.julialang.org/u/Frank_Applin)\
**Post date:** [October 6, 2017, 2:16pm UTC](https://discourse.julialang.org/t/dereference-a-pointer/6251/25 "2017-10-06T14:16:42Z")

</div>

Hi Simon. I’ll try to post what I’m working on to my github. It probably won’t be until Monday (sorry). I saw on your site that it looks like you tried to go down the same route I did with converting the i2c-dev.h to Julia. I got nowhere with that. I was told that Julia didn’t have an equivalent to the C union. So, I have just made a shared library out of i2c-dev.h (made it a C file and stripped the “static inline” from the front of each function). Then, I made a Julia wrapper module to go against that. I have to come up with a way to deploy it so it will compile the source into the shared library on the source machine. My ideas are kind of trying to think “big picture” - for different linux based development boards - not just the Pi. Since, they all do GPIO the same through the file system and all do i2c basically the same. You can look at the idea at:

[https://github.com/fapplin/Julia\_On\_Development\_Boards](https://github.com/fapplin/Julia_On_Development_Boards)

This is something I would like to present at the next Julia conference and maybe present at a Pi conference. I’ll try to get you the code up on this site by the end of the day, but I think you get the gist of what I did.

---

<div class="post-metadata">

**Author:** ![Frank\_Applin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frank_applin/32/1654_2.png) [@Frank\_Applin](https://discourse.julialang.org/u/Frank_Applin)\
**Post date:** [October 6, 2017, 6:29pm UTC](https://discourse.julialang.org/t/dereference-a-pointer/6251/26 "2017-10-06T18:29:25Z")

</div>

The files are on my github site. I was trying to make the Julia\_I2C module more self-contained, but I just couldn’t get it to work. So, what worked is up there.

[Previous page](https://discourse.julialang.org/t/dereference-a-pointer/6251.md?page=1)
