0

I wanted to assign a boolean value to a two-dimensional boolean array, but the compiler showed an error

bool Amass[100][80];

Amass[1,1] = true; //even so I see only an error    
Vlad from Moscow
  • 301,070
  • 26
  • 186
  • 335

1 Answers1

1

You have declared a two-dimensional array

bool Amass[100][80];

However in this statement

Amass[1,1] = true;

in the subscript operator expression you are using the comma operator. Its result is the right-most operand. That is the statement is equivalent to

Amass[1] = true;

So in the left side of the assignment there is used a one-dimensional array.

It seems you mean

Amass[1][1] = true;
Vlad from Moscow
  • 301,070
  • 26
  • 186
  • 335