读书人

请问定义一个const int指针报错的有关

发布时间: 2012-02-20 21:18:25 作者: rapoo

请教定义一个const int指针报错的问题
定义:const int *p = new const int(1234);
为什么在VC6里报
error C2468: 'new ' : cannot allocate 'const '/ 'volatile ' objects (type is 'const int ')
error C2166: l-value specifies const object

[解决办法]
const int *p = new int(1234);

读书人网 >C++

热点推荐