expected an expression

I am making a small battleships game, and i keep getting the error "expected an expression" in this line:

while (comgameboard [9][9] != {'.'} && urboard [9][9] != {'.'})
|
in the spot where the line is. Please help
Last edited on
When posting code, it is advised to use the code tags, which is the <> icon near the text field.

My guess is that you should substitute your braces for either parentheses or nothing.

ex:
 
while (comgameboard [9][9] != '.' && urboard [9][9] != '.')


or

 
while (comgameboard [9][9] != ('.') && urboard [9][9] != ('.'))
Last edited on
The thing is, its a 9 by 9 array, and i need it to include the whole thing, and not just the bit which is 9,9 (coordinates). Will it still work like that if i do it the way you said?
I'm not sure what exactly you mean, but the code I suggested should exit the loop once comgameboard[9][9] = '.' or urboard[9][9] = '.'
Topic archived. No new replies allowed.