title: Not understanding how to access the elements of a vector in Rust
body: <p>This is my first encounter with Rust, and I am reading the chapter on vectors in the current version of the <a href="https://doc.rust-lang.org/book/ch08-01-vectors.html" rel="noreferrer">Rust Book</a>. I do have previous experience with other languages (mostly functional ones, where the following issues are hidden).</p>
  
  <p>Running the following code snippet (from the book) returns <code>3</code>:</p>
  
  <pre><code>fn main() {
    let v = vec![1, 2, 3, 4, 5];
    let third: &amp;i32 = &amp;v[2];
    println!("{}", third);
  }
  </code></pre>
  
  <ol>
  <li>The first thing that I do not understand is why the <code>third</code> inside the <code>println!</code> macro isn't referenced. I would have expected the above code to print the memory address of the 3rd element of <code>v</code> (as in C and C++), not its content.</li>
  </ol>
  
  <p>Consider now the code (notice the reference this time inside <code>println!</code>):</p>
  
  <pre><code>fn main() {
    let v = vec![1, 2, 3, 4, 5];
    let third: &amp;i32 = &amp;v[2];
    println!("{}", *third);
  }
  </code></pre>
  
  <ol start="2">
  <li>Why does the code code above produce exactly the same output as the one above it, as if the <code>*</code> made no difference?</li>
  </ol>
  
  <p>Finally, let us rewrite the above code snippets eliminating references completely:</p>
  
  <pre><code>fn main() {
    let v = vec![1, 2, 3, 4, 5];
    let third: i32 = v[2];
    println!("{}", third);
  }
  </code></pre>
  
  <ol start="3">
  <li>Why does this last version produce the same output as the previous two? And what type does <code>v[2]</code> really have: is it an <code>&amp;i32</code> or an <code>i32</code>?</li>
  </ol>
  
  <p>Are all of the above a manifestation of the automatic dereferencing that is only once alluded to in a previous chapter? (If so, then the book should be rewritten, because it is more confusing than clarifying.)</p>