okOk this is the code for sorting I have written but now I dontdon't know what file to compile to check for my results.Cuz Because of the addition of printfprintf()
function I have added stdio.hstdio.h into my helpers.chelpers.c but still I am not getting my printfsprintf()
s. Tried compiling with ./generate 10 50 | ./find 12./generate 10 50 | ./find 12
still no result....I cant I can't get my sorting list printed out.Am Am i missing some key thing here?
void sort(int values[], int n) { // TODO: implement an O(n^2) sorting algorithm int i, j, k; for ( j = 0; j < n - 1; j++) {
for (i = 0; i < n - j; i++)
{
if (values[i] > values[i +1])
{
int temp = values[i] ;
values[i] = values[i+1] ;
values[i+1] = temp ;
}
}
}
return;
for ( k = 0; k < n; k++)
{
printf("no %i : %i\n", k , values[k]);
}
}
void sort(int values[], int n)
{
// TODO: implement an O(n^2) sorting algorithm
int i, j, k;
for ( j = 0; j < n - 1; j++)
{
for (i = 0; i < n - j; i++)
{
if (values[i] > values[i +1])
{
int temp = values[i] ;
values[i] = values[i+1] ;
values[i+1] = temp ;
}
}
}
return;
for ( k = 0; k < n; k++)
{
printf("no %i : %i\n", k , values[k]);
}
}
orOr am i supposeI supposed to make another file paste this code in there and get an array of lets say 10 ints throughtthrough GetInt() and than see if I am getting the desired sorted list or not?