“lvalue required as left operand of assignment ” error

后端 未结 4 1941
清歌不尽
清歌不尽 2020-12-10 20:36

The following code produces a \"lvalue required as left operand of assignment\"

if( c >= \'A\' && c <= \'Z\'  || c = \" \" || c = \",\") {
         


        
4条回答
  •  旧巷少年郎
    2020-12-10 21:30

    equality is ==, = is assignment. You want to use ==. Also "" is a char*, single quotes do a character.

    Also, adding some parens to your condition would make your code much easier to read. Like so

     ((x == 'c' && y == 'b') || (z == ',') || (z == ' '))
    

提交回复
热议问题