Use std::vector instead of c array