title: Pointer Arithmetic in C using Array Variables
body: <p>I am in the process of learning C, and have begun exploring the world of pointers and pointer arithmetic. For example,  in the following code snippet:</p>
  
  <pre><code>int nums[] = {1, 2, 3};
  </code></pre>
  
  <p><code>nums</code> is an Array variable and acts like a pointer that points to the first memory location of the array. I wrote the following sample code and am trying to understand why I am getting the results that I am getting:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt; 
  
  int main() 
  {
    int nums[] = {1, 2, 3};
  
    if(nums == &amp;nums)
      puts("nums == &amp;nums");
    else
      puts("nums != &amp;nums");
  
    if((nums + 1) == (&amp;nums + 1))
      puts("(nums + 1) == (&amp;nums + 1)");
    else
      puts("(nums + 1) != (&amp;nums + 1)");    
  
    printf("nums: %i\n", nums);
    printf("&amp;nums: %i\n", &amp;nums);
    printf("nums + 1: %i\n", nums + 1);
    printf("&amp;nums + 1: %i\n", &amp;nums + 1);
  
    return 0;    
  }
  </code></pre>
  
  <p>I am getting that <code>nums == &amp;nums</code> is true as expected; however, when I apply pointer arithmetic and add <code>1</code> to <code>nums</code> this result does not equal <code>&amp;nums + 1</code>. In other words <code>(nums + 1) != (&amp;nums + 1)</code> even though <code>nums == &amp;nums</code>.</p>
  
  <p>This is the output of the program that I get:</p>
  
  <pre><code>nums == &amp;nums
  (nums + 1) != (&amp;nums + 1)
  nums: 2345600
  &amp;nums: 2345600
  nums + 1: 2345604
  &amp;nums + 1: 2345612
  </code></pre>
  
  <p>It appears that <code>nums</code> and <code>nums + 1</code> are off set by 4 bytes; however, <code>&amp;nums</code> and <code>&amp;nums + 1</code> are offset by 12. Why is it that this offset is by 12 bytes and not by 4?</p>