title: Can we subtract NULL pointers?
body: <p>Since pointer arithmetic is defined within the same array I'm in doubt if we can subtract <code>NULL</code> from another <code>NULL</code>. I'm concerned about the implementation of:</p>
  <pre><code>//first and second can both either be from the same array 
  //or be both NULL
  prtdiff_t sub(void *first, void *second){
      //Do I really need this condition?
      if(!first &amp;&amp; !second)
          return (ptrdiff_t) 0;
  
      return second - first;
  }
  </code></pre>
  <hr />
  <p><strong>Note</strong>: This question about C. If you are looking for C++ question, it is <a href="https://stackoverflow.com/q/27681633/5447906">here</a> (the answer is different!). There is also <a href="https://stackoverflow.com/q/8128168/5447906">common question</a> for both C and C++.</p>