Meaning of codes

Void convert(intT[]; int Num)
{
int i,j, temp;
for(i=Num;i>0;i-=1)
{
J=i-1;
temp=p[i];
p[i]=p[j];
p[j]=temp;
}
}
Please explain each code
in this why loop condition is 1-=1
i -= 1 implies that it is decrementing, not incrementing. So it counts down from Num to 0.
Thank you. meaning of j=i-1 ?

Is this complete code for swap
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.
Topic archived. No new replies allowed.