Now, before everyone says anything, I know that goto statements are never needed. Having said that, I was given an assignment to implement them into a sort of some type. I was assigned selection sort and figured that if I wrote the sort without go to's, it would be easier to just implement them after. Well I'm having trouble understanding how to implement them. Here's my code for the selection sort code. Array A is the array that contains the numbers that need to be sorted. Can anyone explain to me where goto statements would need to be implemented?
int i;
*numberCompares = 0;
*numberMoves = 0;
for (i = 0; i <= n-2; i++)
{
int T,j,select = i;
for (j = i+1; j <= n-1; j++)
{
if ( (*ShouldSelect)(A[select],A[j]) ) select = j;
*numberCompares += 1;
}
T = A[i]; A[i] = A[select]; A[select] = T;
++*numberMoves, ++*numberMoves, ++*numberMoves;