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.

+3


source to share


2 answers


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.

+2


source


The error message says it Kc[n]

is an array of int

s. It should be int

.



If you want it to Kc[n]

be an integer, you missed it.

+2


source







All Articles