must be the array-declaration (the code seems ok)

var buildings[300]; // global var