Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Danger, Jason Robinson

Name: Anonymous 2009-10-31 19:49


for(int i = 0; i != 10; i++)
for(int i = 0; i < 10; i++)
for(int i = 0; i != 10; ++i)
for(int i = 0; i < 10; ++i)


From the options above, number 3's the best, isn't it?

Name: Anonymous 2009-11-01 13:53

If possible you should loop downwards to zero, it's usually more efficient that way.

But to answer op, for such a small thing it's best to just unroll it:


i = 0;
(loop body)
i = 1;
(loop body)
i = 2;
(loop body)
i = 3;
(loop body)
i = 4;
(loop body)
i = 5;
(loop body)
i = 6;
(loop body)
i = 7;
(loop body)
i = 8;
(loop body)
i = 9;
(loop body)

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List