char ,signal char and unsigned char

Discussion in 'Programmer's Corner' started by micro1, Feb 28, 2015.

  1. micro1

    Thread Starter Member

    Feb 22, 2015
    52
    0
    hello
    what is the difference between char ,signal char and unsigned char in c programming?
     
  2. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    char and unsigned char are both data types in C.

    Unsigned ranges between 0 and +255.

    Signed ranges from -128 to +127. "char" is signed by default.

    A single char (character) will fit in a char type.
     
    micro1 likes this.
  3. WBahn

    Moderator

    Mar 31, 2012
    17,715
    4,788
    Whether "char" is signed or unsigned is implementation defined. If you NEED it to be signed, then you best use the "signed" modifier (which is why it exists -- if all integer types were signed by default, there would be no need for it).

    Also, it must be at least 8-bits, but can be more. It must be able to hold the entire basic execution character set, represented as strictly positive values, and the entire source code character set, though it can represent those as negative values if desired.
     
Loading...