From here, it’s clear that char
can't store extended ASCII values, so we use unsigned char
.
The basic ASCII values are in the range 0 to 127. The rest part of the ASCII is known as extended ASCII. Using char or signed char we cannot store the extended ASCII values. By using the unsigned char, we can store the extended part as its range is 0 to 255.
But According to this answer, after 127 characters are invalid
ASCII was and is only defined between 0 and 127. Everything above that is either invalid or needs to be in a defined encoding other than ASCII (for example ISO-8859-1).
So, what's the purpose of extended ASCII values, Why use unsigned char
over char
if after 127 ASCII values all characters are invalid?