[NSRCA-discussion] Chapter-12 computer science.

Matthew Frederick mjfrederick at cox.net
Tue Jul 3 21:27:38 AKDT 2007


I was thinking the same way you were, Marty, but according to the guy who 
posted it, its an infinite loop. Also, if our thinking on the way it would 
operate was correct, the value of cnt at the end would be 256 (since it 
increments before the condition is tested)... On a more personal note, I've 
been impressed to see a Jesuit who is into R/C airplanes. My brother joined 
the Novitiate in Grand Couteau, LA last August. He seems to be really 
enjoying it, and it looks like he's going to stay with it.

Matt

----- Original Message ----- 
From: "Martin X. Moleski, SJ" <moleski at canisius.edu>
To: "NSRCA Mailing List" <nsrca-discussion at lists.nsrca.org>
Sent: Wednesday, July 04, 2007 12:05 AM
Subject: Re: [NSRCA-discussion] Chapter-12 computer science.


> John Pavlick wrote:
>> OK, what does this do?
>
>> char foo(void)
>> {
>>      char cnt, num;
>>
>>     for(cnt = 0, num = 0; cnt < 256; cnt++)
>>     {
>>          num++;
>>     }
>>     return num;
>> }
>
>
> Initializes cnt and num to 0.
>
> Increments cnt and num from 0 to 255
> by passing through the for loop.
>
> Returns 255.
>
>
> Marty
> _______________________________________________
> NSRCA-discussion mailing list
> NSRCA-discussion at lists.nsrca.org
> http://lists.nsrca.org/mailman/listinfo/nsrca-discussion
> 



More information about the NSRCA-discussion mailing list