title: Checking if an index of an array is empty
body: <p>I'm currently trying to write a script so that I can add an item to the last index the array has an item in. For example, if I initialized an array <code>int a[5]</code> and <code>a[0], a[1], a[2]</code> all have something, then the integer would be added to <code>a[3]</code>Here is what I have :</p>
  
  <pre><code>int main(){
      int a[5];
      a[0] = 10;
      a[1] = 20;
      a[2] = 30;
      for (int i = 0; i &lt; 5; i++){
          if (a[i] &lt; 0){
              a[i] = 40; //Just an example for what it would be like.
          }
      }
  }
  </code></pre>
  
  <p>I can't help but feel that there is a better way to do this, maybe a different <code>if</code> condition. I want to know if there's another way to check if the next index is empty.</p>