InterviewSolution
Saved Bookmarks
| 1. |
What kind of loop is better - Count up from zero or Count Down to zero? |
|
Answer» Loops that involve COUNT down to zero are BETTER than count-up loops. This is because the compiler can optimize the comparison to zero at the time of LOOP termination. The processors need not have to load both the loop variable and the MAXIMUM value for comparison due to the optimization. Hence, count down to 0 loops are ALWAYS better. |
|