Bitwise XOR operation in Java
I am facing this error while executing my program.
"invalid operand types for binary operator '^' first type: int second type: int []"
int temp1;
for(int m = 1;m<height;m++)
{
temp1 = 2*m-1;
for(int n = 0;n<width;n++)
{
r[temp1][n] = r[temp1][n]^Kc[n];
}
}
This will help me a lot, Thanks.
source to share
You can apply the operator ^
to two int
s, not an array int
and int
.
The error message Kc[n]
is an array int
.
You can apply the operator on two int
:
r[temp1][n] = r[temp1][n]^Kc[temp1][n];
I have no idea if the values ββare indices (since I don't know the sizes of the two arrays), so you might have to change them.
source to share