new and delete!
#include <vector>
#include <string>
using namespace std;
int main()
{
vector<string>vec;
string a;
cout<<"input the string (ctrl+z to end)"<<endl;
while(cin>>a)
{
vec.push_back(a);
}
char **p=new char*[vec.size()];
vector<string>::iterator iter=vec.begin();
int i(0);
while(iter!=vec.end())
{
char *p1=new char [(*iter).size()];
strcpy(p1,(*iter).c_str());
p[i]=p1;
++iter;
++i;
}
for(int i(0);i!=vec.size();++i)
delete p[i];//这里参考答案上是delete []p[i],我感觉是delete p[i],哪个对呢!?
delete []p;
system("pause");
return 0;
}