+ 3
code decipher!!
Can anyone please explain this code.. why the output is 1. #include <stdio.h> int main() { int a=2^3; printf("%d",a); return 0; }
3 ответов
+ 3
Try to read this and tell me if you're still having difficulty after reading,
https://www.sololearn.com/learn/4074/?ref=app
+ 2
^ is a bitwise operation, used in low level programming
+ 1
It's funny that you mention "decipher" in the tags... xor is used in encrypting and decrypting.
As you observed,
2^3 = 1
and it is reversible:
1^3 = 2
They can flip flop all day long with no loss of information, so if you have the same key (3 in this case) you can encode and decode. A big drawback is that if there is a 0 in the message, then it exposes the key: 0^3 = 3.