func main() {
var a int64 = ^0
fmt.Printf("%b\n", a)
}
Why the console print “-1”?
NobbZ
(Norbert Melzer)
2
Because that is how negative numbers are represented internally. -1
is represented by setting all bits 1.
system
(system)
Closed
4
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.