-
Aaah okey I didn't get what you were trying to say, ok will try that out to see if it works... thanks :)
Will come with the results soon ;)
EDIT:
Ok changed:
Code:
table tmp;
tmp.cell[j] = t->cell[j];
t->cell[j] = t->cell[j+1];
t->cell[j+1] = tmp.cell[j];
to:
Code:
char **tmp;
tmp = t->cell[j];
t->cell[j] = t->cell[j+1];
t->cell[j+1] = tmp;
Is this what you meant? BTW and very important I realised how stupid I am just when I read the while loop and found it was wrong, order = 1; should be out of the for loop not inside of it... changing this and doing what tabstop suggested seems to solve the segmentation fault... just tested once so I'll keep testing and will come back u.u
EDIT 2:
Tested various times and it works as expected :D
So if the replacement is what you meant tell me please so I'm confident enough that this is alright and solved ok?
p.s.: I feel sooo stupid lol... at least I don't need now a table tmp... ;)
-
Yes, that's what you want to use to swap. This is one place (perhaps the only one place) where the weirdness of dynamic higher-dimension arrays actually helps you; if this had been a real array you would have had to swap the entire row (although rather than loop through it you'd probably just use memcpy).
-
Ok thank you very much! It is in deed working now ^^
I have another problem with higher-dimension dynamic arrays so I'll open a new thread because it has nothing to do with this is more of a memory issue...
Thanks again!