# Values of arrays changed unexpectedly due to storage allocation issue?

**URL:** <https://discourse.julialang.org/t/values-of-arrays-changed-unexpectedly-due-to-storage-allocation-issue/73135>\
**Category:** General Usage\
**Tags:** arrays\
**Created:** [December 15, 2021, 11:11am UTC](https://discourse.julialang.org/t/values-of-arrays-changed-unexpectedly-due-to-storage-allocation-issue/73135 "2021-12-15T11:11:39Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![MichaelGao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/michaelgao/32/27370_2.png) [@MichaelGao](https://discourse.julialang.org/u/MichaelGao)\
**Post date:** [December 15, 2021, 12:04pm UTC](https://discourse.julialang.org/t/values-of-arrays-changed-unexpectedly-due-to-storage-allocation-issue/73135/4 "2021-12-15T12:04:29Z")

</div>

Hope these further discussions & documentations could help other newcomers of Julia like me.

> [@Copy vector?](https://discourse.julialang.org/t/copy-vector/20082):
>
> I just realized this behavior: julia\> x = [0. , 0.] 2-element Array{Float64,1}: 0.0 0.0 julia\> y = x 2-element Array{Float64,1}: 0.0 0.0 julia\> y[1] = 1. 1.0 julia\> x 2-element Array{Float64,1}: 1.0 0.0 x and y are just different names for the same vector. How do I copy a vector into another one, then? Also, is there any style suggestion to avoid running into errors given that we could be modifying previous values of array variables this way?

[https://docs.julialang.org/en/v1/base/base/#=](https://docs.julialang.org/en/v1/base/base/#=)

---

_[View the full topic](https://discourse.julialang.org/t/values-of-arrays-changed-unexpectedly-due-to-storage-allocation-issue/73135)._
