Ask your own question, for FREE!
Computer Science 9 Online
OpenStudy (anonymous):

Is it more efficient / better to do A or B? A) int i = 0; for (i = 0; i < 100; i++) for (i = 0; i > 200; i++) {} B) for (int i = 0; i < 100; i++) {} for (int i = 0; i > 200; i++) {} The thing I'm getting at is when dealing with multiple for loops, is it better to use the same integer or declare a new integer every time?

OpenStudy (konradzuse):

depends. If I isn't needed again then do A, if byou need i again somewhere in the loops etc do the B. I've done either.

OpenStudy (konradzuse):

Also in both for (int i = 0; i > 200; i++) {} byou wold do i = something.length or the highest # then do i--

OpenStudy (konradzuse):

so it would be for( int i = size; i > 0; i--)

OpenStudy (konradzuse):

no medal? :(

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Arriyanalol: i need help
2 days ago 7 Replies 1 Medal
Arriyanalol: CONGRATS to me
2 days ago 8 Replies 2 Medals
Legomaster346: What colleges are good that are near Arab Alabama?
1 week ago 5 Replies 0 Medals
Arriyanalol: i need help
1 week ago 6 Replies 2 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!