title: What is decltype and how is it used?
body: <p>I haven't been able to find a good explanation of decltype. Please tell me, as a beginning programmer, what it does and why it is useful.</p>
  
  <p>For example, I am reading a book that asked the following question. Can someone explain to me the answer and why, along with some good (beginner-level) examples?</p>
  
  <blockquote>
    <p>What would be the type of each variable and what value would each variable have when the code finishes?</p>
  
  <pre><code>int a = 3, b = 4;    
  decltype(a) c = a;
  
  decltype((b)) d = a; 
  
  ++c; 
  
  ++d;
  </code></pre>
  </blockquote>
  
  <p>A line-by-line explanation would be very helpful.</p>