首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

const int *p = new const int[十]()

2012-09-06 
const int *p new const int[10]()const int *p new const int[10]()const int *p new const int[

const int *p = new const int[10]();
const int *p = new const int[10]();  
const int *p = new const int[10];
我在C++primer上看的说第一种已经初始化 没有错误 但是在编译器上为什么没有通过? 还是有错

error C2468: 'new' : cannot allocate 'const'/'volatile' objects (type is 'const int [10]')

[解决办法]
把后面的const去掉,。。。
[解决办法]
const int *p这里已经表示所指内存元素是const的了

热点排行