Char is unsigned
Unsigned char is unsigned and contains all positive numbers.
If both are used as characters, there is no difference, but there is a difference when using integers:
Char Integer Range:-128 to 127,
The Integer Range of unsigned char is 0 to 255.
In most cases, data of the char, signed Char, and unsigned char types share the same characteristics. However, when you assign a single byte number to a large integer number field, you will see their differences in symbol extension. Another difference is that when a number between 128 and 255 is assigned to the signed Char variable, the compiler must first convert the value, and a warning will also appear. It is easier to use unsigned char to assign values in hexadecimal notation. Depending on the compiler implementation, char is either equivalent to signed Char or equivalent to unsigned char.
Unsigned char * is the same as char.
Function: counts the number of Chinese characters in a string (the internal code of gb2312 is greater than 0xa0)
Char sztext [] = "12345 hello ";
L = strlen (sztext );
Int sum = 0;
For (INT I = 0; I <L; I ++)
If (sztext [I]> 0xa0)
Sum ++;
Sum/= 2;
In this way, you can calculate all Chinese characters,
Because char is signed, the maximum number is 127. If it is exceeded, it becomes the plural. For example, if 7f is 127, 80 is-1.
At this time, you must write
Unsigned char sztext [] = "12345 hello ";