what is the difference between a char and an unsigned char?
Also is char* used for returning an array of characters?
what is the difference between a char and an unsigned char?
Also is char* used for returning an array of characters?
yes, char * can be used to return a null terminated char array. But be careful, this can lead to errors related to scope if not used properly.
As to char vs unsigned char, I believe it goes thusly. The char type routinely is assigned 1 byte of memory. Each byte of memory contains 8 bits of memory. Each bit can be thought of as either a 0 or a 1 in binary memory. Therefore each byte can store 2^8 or 256 different combinations of 0s and 1s or 256 binary numbers. But which 256 numbers should be used. If you use signed char type, which is the default I believe, then the numbers range from -127 to 128, and usually just the range from 0 to 128 is used. If you use unsigned char then the range is from 0 to 255. The 0-128 is used for the standard ASCII char set, and the 0-255 range is used for the extended ASCII char set. Or at least thats what I think the situation is.
To quote my C++ programmers reference...
...... whatever that means!Whether char is signed or unsigned is implementation dependant
Visit entropysink.com - It's what your PC is made for!