While leaning Rust, I see the following code.
let arr = &[0; 5];
arr
I wonder
- Why can we use
&
before an array in the example above but not if I change[0; 5]
tovec![0; 5]
? - What do we use
&[0; 5]
instead of[0; 5]
? What is the advantage of the first way?