Is this Bitwise XOR? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Is this Bitwise XOR?

does anyone know how to explain what the below code does? Particularly the str[i]^=32; if (str[i]>='a' && str[i]<='z'){ str[i]^=32; }

27th Nov 2017, 10:29 PM
Deolijus
Deolijus - avatar
1 Answer
+ 6
It is the same as: str[i] = str[i] ^ 32; This gets the current value held in str[i] and performs a bitwise XOR by 32 and then sets the resulting value back in str[i]. https://www.cprogramming.com/tutorial/bitwise_operators.html
27th Nov 2017, 10:40 PM
ChaoticDawg
ChaoticDawg - avatar