Well, the meaning of j=i-1 is that j is... well, equal to one less than i. In context of the code, p[i] will always be in one spot ahead of p[j] in the array. Since i is never zero, this code will therefore take the element at location p[Num], and shuffle it to the front of the array. Yes, it is the complete code of the swap.