I'd suggest using std::vector for all your arrays and pass them by reference.