what *p1 ^= *p2; does in c

后端 未结 4 847
别那么骄傲
别那么骄傲 2021-01-29 06:09

In C what does this statement do?

*p1 ^= *p2;

p1 and p2 are char pointers pointing to two different address of a char

4条回答
  •  闹比i
    闹比i (楼主)
    2021-01-29 06:28

    This

    *p1 ^= *p2;
    

    is the compound assignment operator with the bitwise exclusive OR operator,

    It is a substitution for this expression statement

    *p1 = *p1 ^ *p2;
    

提交回复
热议问题