# Set value at C pointer in a Julia callback function

**URL:** <https://discourse.julialang.org/t/set-value-at-c-pointer-in-a-julia-callback-function/92286>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [December 29, 2022, 7:36pm UTC](https://discourse.julialang.org/t/set-value-at-c-pointer-in-a-julia-callback-function/92286 "2022-12-29T19:36:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![doer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/doer/32/45486_2.png) [@doer](https://discourse.julialang.org/u/doer)\
**Post date:** [December 29, 2022, 7:36pm UTC](https://discourse.julialang.org/t/set-value-at-c-pointer-in-a-julia-callback-function/92286/1 "2022-12-29T19:36:15Z")

</div>

I am trying to use Julia with the Gnu Scientific Library (GSL) multimin functionality. This requires definition of three callback functions, one of which passes a C double\*. Here is the C function signature:

```julia
void my_fdf (const gsl_vector *x, void *params, double *f, gsl_vector *df)

```

And here is the Julia callback function signature:

```julia
function my_fdf(_v::Ptr{GSL.C.gsl_vector}, _params::Ptr{Cvoid}, f::Ptr{Cdouble}, _df::Ptr{GSL.C.gsl_vector})::Cvoid

```

The problem I have is most likely a new-to-Julia problem - how do I set the value of f? In the C function, I would do something like this:

```julia
*f = 123.4

```

What is the equivalent Julia syntax?

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [December 29, 2022, 9:56pm UTC](https://discourse.julialang.org/t/set-value-at-c-pointer-in-a-julia-callback-function/92286/2 "2022-12-29T21:56:08Z")

</div>

[`unsafe_store!(f, 123.45)`](https://docs.julialang.org/en/v1/base/c/#Base.unsafe_store!)

---

<div class="post-metadata">

**Author:** ![doer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/doer/32/45486_2.png) [@doer](https://discourse.julialang.org/u/doer)\
**Post date:** [December 30, 2022, 2:02am UTC](https://discourse.julialang.org/t/set-value-at-c-pointer-in-a-julia-callback-function/92286/3 "2022-12-30T02:02:57Z")

</div>

Awesome, thank you for your prompt response.
