`
ccjsjymg
  • 浏览: 60563 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

ISO C++ forbids cast to non-reference type used as

阅读更多
int main(){
char arra[] = "abcd";
    char *ch =arra;
while((*ch++ = *arra++) != '\0' )
    {            
            cout<<*ch;     
    }

}

为什么不能non-reference类型作为左值,这里不太理解,哪位大侠能解释下。。。。。。。。
分享到:
评论
3 楼 ccjsjymg 2009-04-11  
c++中数组是一个常指针,它所指向的内存的首地址不能改变,所以不能使用arra++,自增形式来对它的指针值进行自增的。
2 楼 量产型人型自走炮 2009-04-11  
arra不是常量指针...严格的说是一个不可更改的L-VALUE(L我的理解是locationable而不是什么左值)
1 楼 ccjsjymg 2009-04-10  
此时arra是常量指针,不能使用arra++形式,所以出现这种低级错误。。。。。。

相关推荐

    C++学习与应用 程序设计

    好好看看,很But what, to serve our private ends, Forbids the cheating of our friends? Charles Churchill Instead of this absurd division into sexes they ought to class people as static and dynamic. ...

    pja_2.5.zip

    It is also impossible to compute off-screen images when the Java security manager forbids access to any Toolkit or the AWT library. In that case you can although create an instance of ...

    串口调试程序

    串口调试程序

    java实现算法

    java实现各种算法,与大家分享

    matlab视网膜图像分割代码-Chap_1:第1章

    as github forbids &gt; 25MB file)发布进行评估,注意训练新模型会删除相应的文件夹) 其他基线代码 计算环境 112GB 内存 Ubuntu 14.04 依赖关系 数据集 杜克大学 Sina Farsiu 教授团队慷慨解囊 结果 用法 训练模型 &gt;...

Global site tag (gtag.js) - Google Analytics