In C++, what's the difference between
char *a = new char[10];
and
char *a = new char(10);
Thanks!
The first allocates an array of 10 char's. The second allocates one char initialized to 10.
Or:
The first should be replaced with std::vector<char>, the second should be placed into a smart pointer.
std::vector<char>
2.1m questions
2.1m answers
60 comments
57.0k users