Please tell me how to implement an array of null-terminated strings? I implemented a string read:
char* get_string(){ constexpr std::size_t initial_size = 4; char* buf = new char[initial_size]; std::size_t used = 0,allocated = initial_size; std::cin >> std::noskipws; char c; while((std::cin >> c) && c!='.'){ if(used+2 > allocated){ allocated = allocated*3/2; char* new_buf = new char[allocated]; for(std::size_t i = 0; i<used;++i) new_buf[i] = buf[i]; delete[] buf; buf = new_buf; } buf[used++] = c; } std::cin >> std::skipws; if(!std::cin){ delete[] buf; buf = nullptr; }else{ ++used; buf[used-1] = '.'; buf[used] = '\0'; } return buf; } The task is to organize an array in which to write such strings.