// TODO: implement an O(n^2) sorting algorithm
int c,i,s;
c = 0;
for (i=0; i < n; i++)
{
if (values[i] > values[i + 1])
{
s = values[i];
values[i] = values[i+1];
values[i] = s;
c++;
}
}
if ((i = n) && (c > 0))
{
i = 0;
void sort(int values[], int n);
}
for (int b = 0; b < n; b++)
{
printf("%d ,", values[b]);
}
return;
It seems this code doesn't do any kind of sort whenever it prints down the values. Can someone please tell me what's wrong? Thanks!