lvalue required as left operand of assignment error when using C++

前端 未结 5 644
耶瑟儿~
耶瑟儿~ 2020-12-28 23:59
int main()
{

   int x[3]={4,5,6};
   int *p=x;
   p +1=p;/*compiler shows error saying 
            lvalue required as left 
             operand of assignment*/
           


        
5条回答
  •  再見小時候
    2020-12-29 00:39

    if you use an assignment operator but use it in wrong way or in wrong place, then you'll get this types of errors!

    suppose if you type:
    p+1=p; you will get the error!!

    you will get the same error for this:
    if(ch>='a' && ch='z')
    as you see can see that I i tried to assign in if() statement!!!
    how silly I am!!! right??
    ha ha
    actually i forgot to give less then(<) sign
    if(ch>='a' && ch<='z')
    and got the error!!

提交回复
热议问题