title: post decrement in while conditon in C
body: <p>I've done a search and I’ve found nothing relevant to my query.
  I am currently debugging a C optimizer and the code in question looks like this:</p>
  
  <pre><code>while( x-- )
  array[x] = NULL;
  </code></pre>
  
  <p>What should happen in this instance? And should the result of this logic be consistent across all compilers? </p>
  
  <p>Lets say that the initial value of x in this case is 5.</p>
  
  <p>The problem is that the program crashes, my understanding is that it is caused by a negative array element reference.</p>
  
  <p>Any help would be appreciated.</p>