What is unsigned char?
unsigned char - type for unsigned character representation. Also used to inspect object representations (raw memory). char - type for character representation which can be most efficiently processed on the target system (has the same representation and alignment as either signed char or unsigned char, but is always a distinct type).
Is it safe to cast between unsigned char and Char?
However, all symbol tables always have positive index. So when you are dealing with strings, you can always safely cast between unsigned char and char. (Pointer casts between the two types are formally poorly defined behavior by the standard, but in reality, it will always work on any system ever made.) Thus printf ("%s", ptr); will work fine.
How to output an unsigned char array as a string?
Thus printf ("%s", ptr); will work fine. An unsigned char array usually represents raw byte data and if you want to output that as a string by using %s, you'll probably get gibberish characters, that'll be of no meaning to you. If you really wish to see the values, then i recommend conversion of a single byte to short and then output it with a %i.
Can a char be used as a string in C?
The answer depends on what you inted to use the unsigned char for. A char is nothing else but a small integer, which is of size 8 bits on 99% of all implementations. C happens to have some string support that fits well with char, but that doesn't limit the usage of char to strings.