0

why in for loop, outer is less then 9,instead of 10

#include<stdio.h> main() { int ctr; //for loop int idSearch,tempId,inner,outer;//search customer id int found=0; int didSwap=0; int custId[10]={111,222,333,444,555,666,777,888,999,100}; float custBal[10]={2.3,900,85,232,44,85,101,54,78,65}; float tempBal; //initialize the for loop for(outer=0;outer<9;outer++) { for(inner=outer;inner<10;inner++) //rest of the code

15th Jul 2020, 4:00 AM
Pankaj Kumar
Pankaj Kumar - avatar
4 Antworten
+ 1
Last element automatically gets sorted that is why we use <9 and not <10 (in case of selection and bubble sort, which it looks like)
15th Jul 2020, 4:25 AM
hackxsaras
0
Can you please share the full code, or At least tell what this code is gonna do?
15th Jul 2020, 4:19 AM
hackxsaras
0
Sort arrays in ascending order
15th Jul 2020, 4:23 AM
Pankaj Kumar
Pankaj Kumar - avatar
0
Thanks
15th Jul 2020, 4:26 AM
Pankaj Kumar
Pankaj Kumar - avatar