Why does the output show ~a even though it is And'ed with 0x0f? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why does the output show ~a even though it is And'ed with 0x0f?

https://code.sololearn.com/cRMFD2hT5lPR/?ref=app

18th Nov 2019, 12:04 PM
DIVYA T
6 Answers
+ 2
Yeah it's printing ~a=1100 Where ~a =-4 and 0x0f is hexa decimal code of 15 And your c =12 And it prints 12th element of array ie 1100 :)
18th Nov 2019, 12:32 PM
Chirag Kumar
Chirag Kumar - avatar
+ 1
~ swim ~ she is getting confused because of line 8 where she is printing "~a"
18th Nov 2019, 12:31 PM
Daljeet Singh
Daljeet Singh - avatar
+ 1
Thank you
18th Nov 2019, 12:50 PM
DIVYA T
+ 1
DIVYA T 👍 ~ swim ~ I did post a comment on the code to begin with it happens some times ...
18th Nov 2019, 12:53 PM
Daljeet Singh
Daljeet Singh - avatar
+ 1
It's ok, my actual program had 7 print statements invoving different bitwise operations. I just copied that one line because I was confused with that part. I'm learning so I don't mind even if my questions look a bit foolish, it's important to clarify so I don't really mind. 😊
18th Nov 2019, 12:58 PM
DIVYA T
0
DIVYA T that's good 👍we all are learning here
18th Nov 2019, 1:06 PM
Daljeet Singh
Daljeet Singh - avatar