ITbull

``````int median (int numbers[], int length)
{
int i=0;

printf("Please enter up to 10 integers.\n");
printf("Enter any letter to terminate input before 10 entries.\n");

for(i=0; i<10; i++)
{
scanf("%d", &numbers[i]);

if(numbers[i]='ch')
break;
}

}

void sort(int numbers[], int length)
{

}

void swap (int* n1, int* n2)
{

int temp = *n1;
*n1 = *n2;
*n2 = temp;

}

int main()
{
int numbers[10]={0};

printf("This program determines the median of a list of numbers.\n\n");

return 0;
}``````

ITbull

I'm stuck trying to implement a sorting algorith...and i also would like to know. is the swap function necessary since i have a sorting function?

``````int median (int numbers[], int length)
{
int i=0;

printf("Please enter up to 10 integers.\n");
printf("Enter any letter to terminate input before 10 entries.\n");

for(i=0; i<10; i++)
{
scanf("%d", &numbers[i]);

if(numbers[i]='ch')
break;
}

}

void sort(int numbers[], int length)
{

}

void swap (int* n1, int* n2)
{

int temp = *n1;
*n1 = *n2;
*n2 = temp;

}

int main()
{
int numbers[10]={0};

printf("This program determines the median of a list of numbers.\n\n");

return 0;
}``````

VernonDozier 2,218

I'm stuck trying to implement a sorting algorith...and i also would like to know. is the swap function necessary since i have a sorting function?

``````int median (int numbers[], int length)
{
int i=0;

printf("Please enter up to 10 integers.\n");
printf("Enter any letter to terminate input before 10 entries.\n");

for(i=0; i<10; i++)
{
scanf("%d", &numbers[i]);

if(numbers[i]='ch')
break;
}

}

void sort(int numbers[], int length)
{

}

void swap (int* n1, int* n2)
{

int temp = *n1;
*n1 = *n2;
*n2 = temp;

}

int main()
{
int numbers[10]={0};

printf("This program determines the median of a list of numbers.\n\n");

return 0;
}
``````

end quote.

Depends on the sorting algorithm. Some sorting algorithms require a swap function as a helper function, some do not. You would likely call your swap function from your sort function rather than from main directly. It all depends on which sort you use. Here are some sorts.
http://en.wikipedia.org/wiki/Sorting_algorithm