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
4 Respostas
+ 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)
0
Can you please share the full code, or At least tell what this code is gonna do?
0
Sort arrays in ascending order
0
Thanks