Subj : Re: which for loop is better? To : comp.programming.threads From : Elie De Brauwer Date : Fri Mar 25 2005 11:22 am sam wrote: > I should've elaborated the problem. Here it goes : for the same number > of total iterations(100*1000 in this example) in nested-for-loops, is > it more effective to have the outer for loop iterate more than the > inner one (case 2), or the other way around (case 1)? > Why not simply test it ? #include #include void printusage(void){ printf("%s\n", "Three parameters expected:"); printf("%s\n", " * Number of test cycles"); printf("%s\n", " * Outer loop repeat"); printf("%s\n", " * Inner loop repeat"); } int main(int argc, char **argv){ if(argc == 4){ int cycle = atoi(argv[1]); int outer = atoi(argv[2]); int inner = atoi(argv[3]); int i,j,k; if(cycle > 0 && outer > 0 && inner > 0){ for(i=0;i