X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f X-Recipient: djgpp AT delorie DOT com From: Sterten AT aol DOT com Message-ID: <8c30b.37d5743f.3b9cd022@aol.com> Date: Sat, 10 Sep 2011 10:37:22 -0400 (EDT) Subject: Re: A printf problem? To: djgpp AT delorie DOT com MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="part1_8c30b.37d5743f.3b9cd022_boundary" X-Mailer: 9.0 SE for Windows sub 5022 X-Originating-IP: [78.49.70.26] x-aol-global-disposition: G X-AOL-SCOLL-SCORE: 0:2:341491328:93952408 X-AOL-SCOLL-URL_COUNT: 0 x-aol-sid: 3039ac1d290a4e6b7622177d Reply-To: djgpp AT delorie DOT com --part1_8c30b.37d5743f.3b9cd022_boundary Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable =20 you may have a typo 52258 for the first, not 55258 =20 =20 =20 In einer eMail vom 10.09.2011 15:45:30 Westeurop=E4ische Normalzeit schreib= t =20 mok-kong DOT shen AT t-online DOT de: Hi, Maybe I have made a very grave mistake, but I just can't yet understand why the code attached below produced the following output: first: cc22 55258 second: d7da 55258 third: ffff 65535 Why are the first two numbers, which are different hexadecimals, printed out as the same decimal number? Thanks for your kind help in advance. M. K. Shen ------------------------------------------------------ #include int main() { unsigned long int g; g=3D0xcc22; printf("first: %8x %10lu\n",g,g); g=3D0xd7da; printf("second: %8x %10lu\n",g,g); g=3D0xffff; printf("third: %8x %10lu\n",g,g); return(0); } --part1_8c30b.37d5743f.3b9cd022_boundary Content-Type: text/html; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable
you may have a typo
52258 for the first, not 55258
 
 
 
In einer eMail vom 10.09.2011 15:45:30 Westeurop=E4ische Normalzeit sc= hreibt=20 mok-kong DOT shen AT t-online DOT de:
= Hi,

Maybe I have made a very grave mistake, but I just ca= n't yet=20 understand
why the code attached below produced the following=20 output:

first:      cc22      = =20 55258
second:     d7da      =20 55258
third:      ffff      =20 65535

Why are the first two numbers, which are different=20 hexadecimals,
printed out as the same decimal number?

Thanks fo= r=20 your kind help in advance.

M. K.=20 Shen

------------------------------------------------------
#in= clude=20 <stdio.h>

int main()
{ unsigned long int=20 g;

   g=3D0xcc22; printf("first:  %8x =20 %10lu\n",g,g);

   g=3D0xd7da; printf("second: %8x = =20 %10lu\n",g,g);

   g=3D0xffff; printf("third:  %8x&n= bsp;=20 %10lu\n",g,g);

   return(0);
}
 
--part1_8c30b.37d5743f.3b9cd022_boundary--