If it's not homework, I'd just use the std::copy() algorithm and then chop off the last element, or better yet, use an std::vector...