title: What is the usage of the asterisk symbol in Rust?
body: <p>I'm new to Rust and I don't understand the following piece of code:</p>
  
  <pre><code>let mut x = 5;
  {
      let y = &amp;mut x;
      *y += 1;
  }
  println!("{}", x);
  </code></pre>
  
  <p>Explanation from the <a href="https://doc.rust-lang.org/book/references-and-borrowing.html#mut-references" rel="noreferrer">Rust site</a>:</p>
  
  <blockquote>
    <p>You'll also notice we added an asterisk (<code>*</code>) in front of <code>y</code>, making it <code>*y</code>, this is because <code>y</code> is a <code>&amp;mut</code> reference. You'll need to use astrisks [sic] to access the contents of a reference as well.</p>
  </blockquote>
  
  <p>If <code>*y</code> is a reference, why does the following code work </p>
  
  <pre><code>fn main() {
      let mut x = 5;
      {
          let y = &amp;mut x;
          println!("{}", y);
      }
  }
  </code></pre>
  
  <p>I know I'm not modifying the value here, but what is the difference and why
  would <code>y += 1;</code> not work?</p>