bool bricks[3][5]={false};
I am trying to check a Boolean array.
the error I am getting is that bricks has to be an lvalue.
if(bricks[2][5]=true)
I know this is very simple, but google is not working very well.
8 replies to this topic
Ad:
#9 Members - Reputation: 723
Posted 17 December 2012 - 02:57 AM
To elaborate a bit: bricks[2,4] is still valid C++, take a look at http://en.wikipedia.org/wiki/Comma_operator.
What it actually does is discard the value of 2 and use 4 as the array subscript. As a result, bricks[2,4] evaluates to bricks[4], which is of type bool[5], thus the incompatibility error.
What it actually does is discard the value of 2 and use 4 as the array subscript. As a result, bricks[2,4] evaluates to bricks[4], which is of type bool[5], thus the incompatibility error.
Edited by rnlf, 17 December 2012 - 02:57 AM.






