I'm clear on your question

However, there is a little mix (again

).
Basically, for numerical calculation both negative (-) and positive (+) values are involved.
For example: calculate 10 - 20 = -20
To deal with negative numbers, computers use a signed bit which is the most significant bit (msb) in a little-endian system. A number with a sign bit is called Signed number. If you are so sure, that you don't need negative numbers, then you can disregard the sign bit and use the full range of bits.
In C, we have two data types for 1 byte data as below.
signed char val; (or simply
char val;) can store numbers from -128 to +127
unsigned char val; can store numbers from 0 to 255
Similarly, we have same for 16-bit and 32-bit data types.
To calculate signed numbers, the method we use in computers is called 2's compliant system.
DefinitionThe two's complement of a binary number is defined as the value obtained by subtracting the number from a large power of two (specifically, from 2N for an N-bit two's complement). The two's complement of the number then behaves like the negative of the original number in most arithmetic, and it can coexist with positive numbers in a natural way.
A 2's-complement system or 2's-complement arithmetic is a system in which negative numbers are represented by the 2's complement of the absolute value; this system is the most common method of representing signed integers on computers. In such a system, a number is negated (converted from positive to negative or vice versa) by computing its two's complement. An N-bit 2's-complement numeral system can represent every integer in the range −2^(N−1) to +2^(N−1)−1.
For example, if N=8 (that is 8-bit or 1 byte), the range is -2^7 to +2^2-1. That is -128 to +127.
Now let see how we are going to store -96 in a signed char type (1-byte).
−95 + 256
= −95 + 255 + 1
= 255 − 95 + 1
= 160 + 1
= 161
Now if you store 161 to a byte, in singed representation, it is -96. In unsigned representation, it is 161.
- Code: Select all
1111 1111 255
- 0101 1111 − 95
=========== =====
1010 0000 (ones' complement) 160
+ 1 + 1
=========== =====
1010 0001 (two's complement) 161
Okay. Now I think you are clear on that. The next is about having numbers, characters, etc...
Computers use to store numbers using the same ASCII character set (0 - 255). Say if you have +#?< characters in memory, this represent a number.
Character 1 in ASCII is 49. So if we store number 49 to a memory location and read it as a character, what you read is 1. If we store 43 to memory and read it back as a character, you will see "+".