Since std::list and std::vector exist, is there a reason to use traditional C arrays in C++, or should they be avoided, just like malloc?
Since std::list and std::vector exist, is there a reason to use traditional C arrays
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In C++11 where
std::arrayis available, the answer is “yes, arrays should be avoided”. Prior to C++11, you may need to use C arrays to allocate arrays in the automatic storage (i.e. on the stack).