unsigned char

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • deveshkumar
    New Member
    • May 2007
    • 1

    unsigned char

    what is the meaning of signed & unsigned with char data type?
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    A signed char holds a value between -128 and 127 (on a system with 8 bit characters), an unsigned char holds a value between 0 and 256.

    Comment

    • pradeep kaltari
      Recognized Expert New Member
      • May 2007
      • 102

      #3
      Considering a system with 8 bit characters::

      In signed char the first bit (Most significant bit) holds the signs and the remaining 7 bits hold the actual value; hence the range: -128 to +127 (max value being 2^7). In unsigned char all the 8 bits hold the value; range:0 to 255 (max value being 2^8).

      Comment

      • pradeep kaltari
        Recognized Expert New Member
        • May 2007
        • 102

        #4
        Originally posted by pradeep kaltari
        Considering a system with 8 bit characters::

        In signed char the first bit (Most significant bit) holds the signs and the remaining 7 bits hold the actual value; hence the range: -128 to +127 (max value being 2^7). In unsigned char all the 8 bits hold the value; range:0 to 255 (max value being 2^8).
        the max value of unsigned char is 2^8-1 i.e 255 (has been put as 2^8 in my last post by mistake)

        Comment

        Working...