标签:
int main() { typedef std::string AddressLines[4]; std::string *pal = new std::string[4]; std::string *pal1 = new AddressLines; delete [] pal; delete [] pal1; return 0; }
typedef std::string AddressLines[4]; 这样定义居然是代表AddressLines是一个string数组,4个string。
new std::string[4] 和 new AddressLines 是同一个意思,删除时必须用delete[]
typedef std::string AddressLines[4]定义了一个string数组,大小为4
标签:
原文地址:http://www.cnblogs.com/panyingying/p/4204998.html