Give some examples of signed char?

give some examples of signed char ???

  • Signed and unsigned char both are used to store a single character. The characters are stored as per their ASCII values. For example, ‘A’ will be stored as 65 as it has value ‘65’ in the ASCII table.
  • You don’t need to specify keyword ‘signed’ for using signed char but you need to mention keyword ‘unsigned’ for using unsigned char. i.e.
  • Instead of writing

signed char name = ‘a’;

  • you can simply write it as :

char name = ‘a’;

  • but in the case of unsigned char, you need to use ‘unsigned’ keyword.

unsigned char name = ‘a’;

  • The size of both is same i.e. 1 byte or 8 bits.

  • ASCII table has 128 characters ranging with values from 0 to 127. The remaining 127 characters is known as extended ASCII character set.

  • In signed char, the extended set takes value from -128 to -1 whereas in unsigned char it takes value from 128 to 255.

  • Thus the range of signed char is -128 to 127 whereas that of unsigned char is 0 to 255.

  • If you try to give value 128 to signed char, it will take value corresponding to the other side of the range i.e. -128. For signed char, the value next to 127 is -128 like in clock after 12 comes 1 and so on. :smiley:

  • Similar if you try to give value 256 to unsigned char, it will take value 0.

  • Just use them according to your requirement.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.