How do I check if an array index has anything in it?

I have an array of ‘structures’ that is empty at the beginning of the game, I have resized this to the maximum length it should ever become as soon as the game starts.

Then, when i want to add something to the array (the player buys a ship), i want to check if there’s an empty slot in the array (an empty space at the dock for the ship).

So, how do i check for an empty index?

I found a solution although I’m not sure it’s the most concise.

I’m checking a part of the structure for a value, if that value is not zero then that index contains a ship.
Then, I’m using a seperate array (‘EmptySlots’) to contain which slots are empty or not.

After the for loop is completed I use a find node to check for empty slots and to place the newly purchased ship into that index of the ‘OwnedShips’ array.

I’m still interested if there is a simpler method than this, although this should work.