Careful "for" Loops
Roy Johnson
rjohnson at shell.com
Wed Mar 27 06:37:35 AEST 1991
In article <3942.27edea2f at iccgcc.decnet.ab.com> browns at iccgcc.decnet.ab.com (Stan Brown) writes:
> I use
> for (p=a; p<a; p++)
> Then if my loop also increments p, the loop still terminates.
I would guess it would terminate before it ever went into the loop,
so it doesn't matter what the loop does. 8^)
> (Yes, I know my loop _shouldn't_ increment p, but sometimes I
> make coding errors.)
Oh. Then you meant for (p=0; p<a; p++) ??
--
======= !{sun,psuvax1,bcm,rice,decwrl,cs.utexas.edu}!shell!rjohnson =======
Feel free to correct me, but don't preface your correction with "BZZT!"
Roy Johnson, Shell Development Company
More information about the Comp.lang.c
mailing list