码迷,mamicode.com
首页 > 编程语言 > 详细

typedef std::string AddressLines[4]定义了一个string数组,大小为4

时间:2015-01-06 07:09:15      阅读:212      评论:0      收藏:0      [点我收藏+]

标签:

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!