Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!ut-emx!walt.cc.utexas.edu!ycy From: ycy@walt.cc.utexas.edu (Joseph Yip) Newsgroups: comp.lang.c Subject: Difference between char and unsigned char Message-ID: <34292@ut-emx.UUCP> Date: 18 Jul 90 21:44:59 GMT Sender: news@ut-emx.UUCP Reply-To: ycy@walt.cc.utexas.edu (Joseph Yip) Organization: The University of Texas at Austin, Austin, Texas Lines: 31 Hi, The char and unsigned char problem has been with me for a long time. I know char represents 7 bits ASCII and unsigned char works with 8-bit. Most of UNIX string functions (strcpy, strcmp,...). malloc() also returns *char, not *unsigned char. Some systems have char defaulted to 8-bit. Other require you to declare explicitly as unsigned char. If I pass a unsigned char pointer to a function that expects a char pointer, e.g. int foo( char *p); ... unsigned char *buf; a = foo(buf); will there be a problem? Will the foo() mask off my 7th-bit? You know I hate writing the same system library functions where the only difference is the 7th-bit. If I am using ANSI C, the compiler will give me warnings or errors because of the type mismatch! Thank you - Joseph Yip Email: joseph@zeus.ee.utexas.edu