title: How to add, subtract memory addresses in C?
body: <p>I have a normal code that requires subtracting two memory addresses of variables inside the code. I can not take any new variable to store the addresses. The end result is calculating the difference between two addresses. I feel that I've no use of pointers since I need the value of the address. </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main() {
      int p=50, q=100;
  
      printf("Address is : %d\n\n", &amp;p);
      printf("Address is : %d\n\n", &amp;q);
      printf("Difference is %d bytes\n", &amp;q - &amp;p);
  
      return 0;
  }
  </code></pre>
  
  <blockquote>
    <p>Address is : 60566160  </p>
    
    <p>Address is : 60566164  </p>
    
    <p>Difference is 1 bytes</p>
  </blockquote>