[Info-vax] decrementing & for loops in C

glen herrmannsfeldt gah at ugcs.caltech.edu
Thu Jan 8 16:04:06 EST 2009


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.

-- glen



More information about the Info-vax mailing list