[Info-vax] decrementing & for loops in C
    Bob Eager 
    rde42 at spamcop.net
       
    Thu Jan  8 16:31:36 EST 2009
    
    
  
On Thu, 8 Jan 2009 21:04:06 UTC, glen herrmannsfeldt 
<gah at ugcs.caltech.edu> wrote:
> vaxinf at chemie.uni-konstanz.de wrote:
> (snip)
> 
> > int i,sum=0,n=10;
>  
> >    for (i = n; i = 0; i--) {
> >        (void)printf (" i: %i\n",i);
> >    }
> 
> Another problem to watch out for in C decrementing
> for loops is shown here:
> 
> unsigned int i,n;
> 
> for(i=n;i>=0;i--) printf(" i=%x\n",i);
> 
> Many compilers will warn about it, though.
Caught by that one many years ago, when compilers *didn't* warn!
-- 
Bob Eager
    
    
More information about the Info-vax
mailing list