delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/07/10/16:21:55

From: "Christopher Nelson" <paradox AT gye DOT satnet DOT net>
To: <djgpp AT delorie DOT com>
Subject: Re: it's amazing (at least for me)
Date: Sat, 10 Jul 1999 13:13:44 -0600
Message-ID: <01becb08$546da000$LocalHost@thendren>
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 4.71.1712.3
X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3
Reply-To: djgpp AT delorie DOT com

-----Original Message-----
From: aperes <ajps AT mail DOT telepac DOT pt>
Newsgroups: comp.os.msdos.djgpp
To: djgpp AT delorie DOT com <djgpp AT delorie DOT com>
Date: Saturday, July 10, 1999 2:55 AM
Subject: it's amazing (at least for me)


>In this little C program if i change the type of variable k (in setup
>function) to byte the program don't work. Can anyone explain me why?


because a byte is 8 bits.

128 64 32 16 8 4 2 1

add them all up and you get 255.  therefore, your loop in setup will never,
ever be false:  any value in a byte is ALWAYS <256.  the value wraps around
at 255 and becomes 1 again.  therefore, you get an infinite loop.

    -={C}=-

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019