title: C++ array with custom objects
body: <p>After searching google and stackoverflow for 2 days I haven't found anything yet</p>
  
  <p>I was working with java about a year now and I decided to create a game on C++ for practice</p>
  
  <p>In java this should work but in C++ it blows my mind.</p>
  
  <p>I have this code </p>
  
  <pre><code>Item* inventory = new Item[24];
  </code></pre>
  
  <p>It's array (inventory) that holds Items</p>
  
  <p>When I allocate dynamicly an array all of its postions are null? 
  And if not, can I make them all null?</p>
  
  <p>And thats the code for add an item at first empty position (pick up an item)</p>
  
  <pre><code>void Inventory::addItem(Item it){
      if(isFull()){
          cout &lt;&lt; "Full inventory" &lt;&lt; endl;
      }else{
          for(int i = 0; i&lt;length; i++){
              if(inventory[i] == nullptr){ // need this to work somehow
                    inventory[i] = it;
              }
          }
      }
  }
  </code></pre>
  
  <p>It needs to be array not a vector because it has fixed size </p>