From: | Emiel Kollof <emiel@xxxxxxxxxxxxx> |
Date: | Wed, 6 Jul 2005 16:33:40 +0200 |
On Wednesday 06 July 2005 15:28, Jonas Trollvik wrote: > how come the argument to isprint is an int and not an unsigned char? > to me it doesnt make sense at all. Because a char can be represented by an integer. In fact, if you look at it in some weird way, a string in C is really just an array of integers terminated by a 0. So it makes sense to use an int for a single character. Also, the '' notation can be used. Example: #include <stdio.h> int main(void) { int a = 'a'; char b = 'b'; printf("%c = %d = 0x%0.2x\n", a, a, a); printf("%c = %d = 0x%0.2x\n", b, b, b); return; } %./t a = 97 = 0x61 b = 98 = 0x62 See? Cheers, Emiel -- TAURUS (Apr 20 - May 20) You are practical and persistent. You have a dogged determination and work like hell. Most people think you are stubborn and bull headed. You are a Communist.
Attachment:
pgp00008.pgp
Description: PGP signature