+ 3

A=~5 B=3 A*B=? And explain what ~ does

Got this qn in challenge

14th Jun 2020, 3:02 AM
Swopnil
Swopnil - avatar
2 Answers
0
TILDE OPERATOR (called also 'complement' or 'invert' operator) is expressed by this formula: ~n = -n - 1 This means that ~5 gives -6 It can be applied only to integers. Curiously can be applied also to booleans. In this case True is replaced with 1 and False is replaced with 0: ~True = -2 ~False = -1
14th Jun 2020, 5:11 AM
Bilbo Baggins
Bilbo Baggins - avatar