Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

1
  • If i write signed int a = -1 , then ` -1` in 2's complement form is 11111111 11111111 11111111 11111111 and then when i use %d to interpret it it prints -1 and %u , it prints 4294967295 and when i write signed int a = 2 , it prints 2 when i use %d and also when i use %u . If 2 would be in two's complement it would be 11111111 11111111 11111111 11111101 , and then it would be a very diffr answer , what i really want to ask is when does 2's complement happen is it depend on - sign or it happens for every integer if type is signed int which must not be the case here. Commented Dec 30, 2016 at 6:28

lang-cpp