top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

C: Why range of signed char is -128 to 127 not -127 to 128?

0 votes
486 views
C: Why range of signed char is -128 to 127 not -127 to 128?
posted Aug 20, 2014 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+2 votes

Most significant bit is one then it identifies a negative number so if you have 8 bits pattern then negative numbers are

10000000 - 11111111 i.e. -128 to -1

and positive numbers are

00000000 - 01111111 i.e. 0 to 127
answer Aug 20, 2014 by Salil Agrawal
Similar Questions
+1 vote

What type of conversion is not accepted in C and why?
a) char to int
b) float to char pointer
c) int to char
d) double to char

+1 vote
#include <stdio.h>
int main()
{
  char val=250;
  int ans;
  ans= val+ !val + ~val + ++val;
  printf("%d",ans);
  return 0;
}
+2 votes

A char can not be a +ve or -ve. last bit is signed bit in accumulator.but not useful for CHAR Whats the purpose? of doing it.

...