# Unexpected change of a function argument (array) - bug or feature?

**URL:** <https://discourse.julialang.org/t/unexpected-change-of-a-function-argument-array-bug-or-feature/80042>\
**Category:** New to Julia\
**Tags:** question\
**Created:** [April 26, 2022, 10:33am UTC](https://discourse.julialang.org/t/unexpected-change-of-a-function-argument-array-bug-or-feature/80042 "2022-04-26T10:33:22Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![DNF](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dnf/32/10191_2.png) [@DNF](https://discourse.julialang.org/u/DNF)\
**Post date:** [April 26, 2022, 10:37am UTC](https://discourse.julialang.org/t/unexpected-change-of-a-function-argument-array-bug-or-feature/80042/2 "2022-04-26T10:37:29Z")

</div>

It’s a feature.

When you type `q = f` you are making `q` point to the same array as `f`. So whatever changes you make to `q` are also visible in `f`. This is extremely useful, but you must be aware of it.

Whenever `f` is a mutable data structure, `q = f` followed by mutation of `q` will be visible in `f`.

If you want to avoid this, write `q = copy(f)` instead. (In some cases you even need `q = deepcopy(f)`.)

BTW: read here to see how to format your code nicely: [Please read: make it easier to help you](https://discourse.julialang.org/t/please-read-make-it-easier-to-help-you/14757)

---

_[View the full topic](https://discourse.julialang.org/t/unexpected-change-of-a-function-argument-array-bug-or-feature/80042)._
