This week's giveaway is in the Spring forum.
We're giving away four 3 month subscriptions to Marco Behler Videos and have Marco Behler on-line!
See this thread for details.
Win a 3 month subscription to Marco Behler Videos this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Integer and Character Representation  RSS feed

 
Uma Kanth
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can some body please explain me the following two terms ?
1)signed two's-complement integers
2)16-bit unsigned integers representing Unicode characters
Thanx in advance
 
Leandro Oliveira
Ranch Hand
Posts: 298
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
signed:
byte ---> -128 to +127
unsigned
char ---> 0 to +65535
-------------------------------------------------
the two's complement:
(working with bytes)
decimal binary
4 ---- 00000100
-4 ---- 11111100
how did I find that -4 was 11111100??
1)invert all bits:
00000100 becomes 11111011
2)add another bit to the end
11111011 + 1 --> 11111100

ok???
 
Uma Kanth
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx alot
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!