title: C pointers and addresses
body: <p>I always thought that *&amp;p = p = &amp;*p in C. I tried this code:</p>
  
  <pre><code> #include &lt;stdio.h&gt;
   #include &lt;stdlib.h&gt;
  
   char a[] = "programming";
   char *ap = &amp;a[4];  
  
  int main(void)
  {
  
   printf("%x %x %x\n", ap, &amp;*(ap), *&amp;(ap));   /* line 13 */
   printf("%x %x %x\n\n", ap+1, &amp;*(ap+1), *&amp;(ap+1));   /* line 14 */
  }
  </code></pre>
  
  <p>The first printf line (line 13) gives me the addresses:</p>
  
  <p>40b0a8 40b0a8 40b0a8</p>
  
  <p>which are the same as expected. But when I added the second printf line, Borland complains:</p>
  
  <p>"first.c": E2027 Must take address of a memory location in function main at line 14</p>
  
  <p>I was expecting to get:</p>
  
  <p>40b0a9 40b0a9 40b0a9. </p>
  
  <p>It seems that the expression *&amp;(ap+1) on line 14 is the culprit here. I thought all three pointer expressions on line 14 are equivalent. Why am I thinking wrong?</p>
  
  <p>A second related question: The line</p>
  
  <pre><code>char *ap = a;
  </code></pre>
  
  <p>points to the first element of array a. I used</p>
  
  <pre><code>char *ap = &amp;a[4];  
  </code></pre>
  
  <p>to point to the 5th element of array a.</p>
  
  <p>Is the expression </p>
  
  <pre><code>char *ap = a;
  </code></pre>
  
  <p>same as the expression</p>
  
  <pre><code>char *ap = &amp;a[0];
  </code></pre>
  
  <p>Is the last expression only more verbose than the previous one?</p>
  
  <p>Thanks a lot...</p>