+ 3
A=~5 B=3 A*B=? And explain what ~ does
Got this qn in challenge
2 ответов
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