+ 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
2 ответов
+ 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