|
From: Per W. <pw...@ia...> - 2008-04-04 14:47:45
|
Almost. The loop will end when n reaches 0. But the last assign will be
performed when n is 1. So the "loop" functions can be rewritten as:
n = 0;
h3 = 1;
return 1;
/pwm
On Fri, 4 Apr 2008, Bruce Fletcher (Stronsay) wrote:
> > why are they useless? why equal to 0? can i have more explanation?
>
> Let's take this bit of code:
> int loopb3()
> {
> for (n = 9; n >= 1; n--)
> b3 = n;
> return b3;
> }
>
> The function loopb3 has a "for..." loop which moves the value of b3 from
> 9 down to 0. It does nothing else. The function loopb3 will _always_
> return 0, which is the final value of b3 after the loop is complete.
> --
> Bruce Fletcher
> Stronsay, Orkney
> <www.stronsay.co.uk/claremont>
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|