1
I am creating a program that sorts a Matrix of structures, first sorts the rows and goes to each row and organizes it by columns. In the matrix I am using after two cycles the value of (i+1 = 4)
, when I call again the function aux is supposed to (l=4 and r=4) and should not enter inside the if, someone can tell me why?
void aux(int l, int r){
int i;
int auxx = 0;
printf("%d, %d\n", l, r);
if(l != r){
for(i = l; i <= r; i++){
if(matrix[i].line == matrix[i+1].line){auxx = auxx +1;}
else{
if(auxx==0){aux(i+1, 4);}
else{
printf("%d\t%d\t%d\t%d\n", i+1, l, auxx+l, 4);
bubblec(l, auxx+l);
aux(i+1, 4);}
}
}
}
}
aux(0, 4);
If the idea is to sort, why recursion? It ends up unnecessarily complicating the solution. And what is supposed to do the function
bubblec
?– Isac