+ 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; }

15th Jul 2022, 3:36 PM
filibuster
filibuster - avatar
3 Respostas
+ 3
Try to read this and tell me if you're still having difficulty after reading, https://www.sololearn.com/learn/4074/?ref=app
15th Jul 2022, 3:44 PM
Ipang
+ 2
^ is a bitwise operation, used in low level programming
15th Jul 2022, 4:01 PM
Кавун 🍉
Кавун 🍉 - avatar
+ 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.
15th Jul 2022, 5:06 PM
Brian
Brian - avatar