Printf question.



Hi,

I was wondering something today. The following code :

unsigned char a = 200;
char b = 200;
printf( "%d %d", a, b );

gives :

200, -56

How comes? I didn't tell printf that the first argument was unsigned
and it detected it on its own. It doesn't seem possible with varargs.
How is it possible?

Thanks,

.



Relevant Pages

  • Re: Strange bit corruption in a double
    ... crunching then occurs, and later on, when I printf this variable ... int bytes = sizeof; ... void print_binary_uc ... unsigned char value2; ...
    (comp.lang.c)
  • fgetc
    ... int main (int argc, char *argv) ... printf("Could not open file\n"); ... this program doesnt work. ...
    (comp.lang.c)
  • Re: Strange bit corruption in a double
    ... crunching then occurs, and later on, when I printf this variable ... int bytes = sizeof; ... void print_binary_uc ... unsigned char value2; ...
    (comp.lang.c)
  • Strange bit corruption in a double
    ... crunching then occurs, and later on, when I printf this variable ... int bytes = sizeof; ... void print_binary_uc ... unsigned char value2; ...
    (comp.lang.c)
  • Re: Strange bit corruption in a double
    ... crunching then occurs, and later on, when I printf this variable ... int bytes = sizeof; ... void print_binary_uc ... unsigned char value2; ...
    (comp.lang.c)