“l-value required” error

前端 未结 11 2189
离开以前
离开以前 2020-12-10 00:06

When do we get \"l-value required\" error...while compiling C++ program???(i am using VC++ )

11条回答
  •  半阙折子戏
    2020-12-10 00:45

    I had a similar issue and I found that the problem was I used a single '=' instead of a double '==' in an if statement

    lvalue error:

     if (n = 100) { code } // this is incorrect and comes back with the lvalue error
    

    correct:

    if (n == 100) { code } // this resolved my issue
    

提交回复
热议问题