[wplug] about basic programming

Tom Rhodes trhodes at FreeBSD.org
Fri Mar 4 15:51:48 EST 2005


On Fri, 4 Mar 2005 14:03:13 -0500
John Harrold <jmh17 at pitt.edu> wrote:

> Sometime in March Juan Zuluaga assaulted the keyboard and produced:
> 

[SNIP]: Discussion on books.

Perhaps someone with years of experiance in programming could
tell me something.  In the following program snip-it:

#include <stdio.h>

#define lastnum 40

int main()
{

  int num = 0;

  while ((num == 0) || (num < lastnum))
    {
      printf("Counting %d up\n", num);
      num++;
    }
  return 0;
}

num is only incremented to 39, one below 40.  Thus far I have
always considered it was because we stop at the number before
the one we define.  So I have always wrote as such.  Yet, I
have not found an explination in either of my two C books.
Am I missing or not properly enterpreting a paragraph/sentence
in my books?

Yea, I'm sure everyone thinks I'm nuts now since I should know
this, but, eh, whatever.  *hand in the air* You don't know me!
:)

-- 
Tom Rhodes


More information about the wplug mailing list