here i have two bubble sort versions.
void bsort()
{
int i,j,jc=0,ic=0,temp,swap=1;
//for(i=0;i<NOE & swap;i++){ this one or
for(i=0;i<NOE-1 & swap;i++){ \\ this
swap=0,ic++;
for(j=0;j<NOE-1-i;j++){
jc++;
if(a[j]>a[j+1]){
temp = a[j];
a[j] = a[j+1];
a[j+1] = temp;
swap = 1;
}
}
}
printf("jc=%d ic=%d\n",jc,ic);
}
i checked it .
in first case it only repeats one extra time which is not nedded .
other than that is there any situation where we get different results with different stataments.
Thanks,