c++报错问题解决方案lvalue required as left operand of assignment
在编程时出现报错:
lvalue required as left operand of assignment
出现此错误原因,是因为,等号左边是不可被修改的表达式或常量。而表达式或常量不能作为左值。归根结底类似于
3=b;
这种错误。
而查看代码发现,是判断出了问题
if(!strA.compare(strB)&&!strC.compare(strD)&&n1=n2){ ... }
由于n1==n2
漏写一个等于号,造成括号内由判断条件变成了赋值语句:左值=n2。而由!strA.compare(strB)&&!strC.compare(strD)&&n1
组成的是一个布尔值常量。显然是不能作为左值的。
原文地址:https://blog.csdn.net/m0_60352504/article/details/123586741
- 上一篇 »php 500报错解决方案
- 下一篇 »php微信网页授权刷新报错解决方案