Quote:
|
Originally Posted by Astronouth7303
so 5 = 00000101 and -5 = !5 + 1 = 11111011
Or did I mis-read that?
I'm just curious, so one has a vague idea what happens if you pass a signed to a unsigned.
|
Well, if you do something like this
unsigned char u_char;
signed char s_char;
.....
u_char = s_char;
The maping will be as follows:
s_char >= 0 : u_char = s_char
s_char <0 : u_char = 256 - s_char
Hope that answers your question... (Note I'm speaking in terms of this micro and this compiler, YMMV on other systems...)