title: What is the logic behind the below program?
body: <pre><code>#include &lt;iostream&gt;
  using namespace std;
  int main()
  {
    int t[4] = { 8, 4, 2, 1 };
    int *p1 = t + 2, *p2 = p1 - 1;
    p1++; 
    cout &lt;&lt; *p1 - t[p1 - p2] &lt;&lt; endl;
    return 0;
  }
  </code></pre>
  
  <p>here p1 = 0x00000007c2affa24[<strong>1</strong>] 
  p2 = 0x00000007c2affa1c[<strong>4</strong>] (address and value) but <strong>p1-p2 = 2</strong></p>
  
  <pre><code>output is -1 
  </code></pre>
  
  <p>I am not able to understand this logic, Please help me. </p>