top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

What is the use of signed and unsigned in case of char data type?

+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.

posted Apr 6, 2015 by Chirag Gangdev

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

1 Answer

0 votes
Best answer

There is nothing called character datatype in C, char just happens to be the smallest integer type
Since char is an integer data type, same (in that regard) as int, short and other integer types, So, just like any other integer type, it can be signed or unsigned.

char is intended to be used to represent characters and represented by their integer "codes", only general difference between char and other integer types is that plain char is by default unsigned while other integer types are signed if not specified anything.

answer Apr 6, 2015 by Salil Agrawal
Similar Questions
+1 vote
#include <stdio.h>
int main()
  char val=250;
  int ans;
  ans= val+ !val + ~val + ++val;
  return 0;
+4 votes

What will be the output of this code?

 void main(){
       int i=320;
       char *ptr=(char *)&i;
+6 votes

What is the simples way to check if the sum of two unsigned integers has resulted in an overflow.