Hello ,
I read that range of the signed char in C is from -128 to 127 and for unsigned char it is 0 to 255.
How can char be signed / unsigned. Can we define negative char???
Thanks
Hello ,
I read that range of the signed char in C is from -128 to 127 and for unsigned char it is 0 to 255.
How can char be signed / unsigned. Can we define negative char???
Thanks
Try it! Print the value, see what happens.
To Subsonics,
which value are you telling me to print?
A negative char...
Code:#include <stdio.h> int main(void) { char ch = -10; printf("%d\n", ch); return 0; }
If you understand what you're doing, you're not learning anything.
A simple char by itself may be signed or unsigned.
If you want to make sure, you need to qualify
signed char foo = -10;
unsigned char bar = 200;
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.