So wie ich reading about ~
war,Warum ist ~ 0 -1?
Führt den NOT-Operator für jedes Bit.
Also habe ich versucht:
0 = 00000000000000000000000000000000
so ~0 should be
~0 = 11111111111111111111111111111111
Aber als ich versuchte, kehrt sie -1
. Ist 11111111111111111111111111111111
nicht 4294967295
in Dezimal?
Duplizieren: http://stackoverflow.com/questions/3141163/why-do-unsigned-int-x-1-and-int-y0-have-the-same-binary-representation – copy
@copy - Es ist in 'C' nicht JavaScript. –
Es ist eine sehr einfache Sache, die für die meisten Programmiersprachen gilt. Lesen Sie http://en.wikipedia.org/wiki/Two%27s_complement oder http://StackOverflow.com/a/3141181/1078067 – copy