After diving into pset3 I have stumbled upon one particular problem. In 'Search' problem we are supposed to write program that will sort values and afterwards search for the requested one. As far as I understood values in for loop (see below) are being overwritten, not swapped (which is ultimate goal, so to speak). Are there any methods to concatenate values to the array, because overwriting them won't bring anywhere?
void sort(int values[], int n)
{
//overrides values[i] with minimum values, no concatenation to array
for(int i = 0; i < n;i++)
{
int tmp = values[i];
if(values[i] > values[i+1])
{
values[i] = values[i+1];
values[i+1] = tmp;
}
}
return;
}