Dynamically increase/decrease array size
问题 I'm trying to increase the size of an array dynamically. Is there any standard C or C++ function, which appends additional space at the end of an array or removes it? I know, this is difficult, since it cannot be assured that there is enough space at the end on the heap. But shouldn't this be the job of an operating system? 回答1: The function you're looking for is realloc() in C, which is also present in the C++ STL as std::realloc Though as you mentioned C++, you could also go for an standard