Ask
your own question, for FREE!
Computer Science
7 Online
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?
Still Need Help?
Join the QuestionCove community and study together with friends!
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.
Also in both for (int i = 0; i > 200; i++) {} byou wold do i = something.length or the highest # then do i--
so it would be for( int i = size; i > 0; i--)
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!
Join our real-time social learning platform and learn together with your friends!
Latest Questions
playtsec:
how do I sleep without getting a sore throat? I always wake up with a sore throat but it goes away later in the day.
75:
how do you react when you deal with someone who plays the victim in every single situation, and do you find this behavior childish or annoying.
JohnnyLFowler0812:
Do you guys ever think that the homeless are going to be healthy and freed from h
JohnnyLFowler0812:
Do you guys ever think that Hikaru Nikanura will ever be take Magnus Calrsen's 1st place title in the wolrdin the United States amd Norway? Right now Hikaru
DoltonCarlee:
what are y'all's options on S A T essays because honestly their not that bad
thereneelg:
Can someone give me a summary of article 231, The war guilt clause?? I need to explain what it is, but I can't find any shortened version of what it is and
luisaam2:
What should you do when the person you want to talk to the most is the one making
2 hours ago
8 Replies
2 Medals
2 hours ago
2 Replies
0 Medals
33 minutes ago
7 Replies
1 Medal
4 hours ago
2 Replies
0 Medals
4 hours ago
7 Replies
2 Medals
3 days ago
7 Replies
1 Medal
2 days ago
16 Replies
1 Medal