Batu
1
Hi all,
Does anybody have an idea for following:
…
unsigned short dd,cc;
scanf("%X", &dd);
scanf("%X", &cc);
printf(" dd:%X, cc:%X", dd,cc);
…
INPUT> 2
INPUT> 3
…
OUTPUT> 0, 3
Any ideas will be appreciated,
thanks in advance,
/Batu
%X expect a int, you are passing and short, so scanf will
write 4 bytes in in value dd and 4 bytes in value cc. You need
%hX i beleive.
Printf alone doesn’t have a problem because of the implicit conversion from
short to int.
“Batu” <ariunbat.dashzegve@am3.com> wrote in message
news:3A1005CE.D669AF7F@am3.com…
Hi all,
Does anybody have an idea for following:
…
unsigned short dd,cc;
scanf("%X", &dd);
scanf("%X", &cc);
printf(" dd:%X, cc:%X", dd,cc);
…
INPUT> 2
INPUT> 3
…
OUTPUT> 0, 3
Any ideas will be appreciated,
thanks in advance,
/Batu