Refactor array.c to autocalculated length