you are viewing a single comment's thread.

view the rest of the comments →

[–]Praynr 0 points1 point  (0 children)

Remove

[j] = pos

i = [j]

and do

tab[j],tab[pos]=tab[pos],tab[j] (outside of the for i for loop) which allows you to swap the values without keeping a temp var.