Hello I've taken some of the advice and corrected some of the errors from the reply but i need the bubble sort explaining in a bit more detail, heres the code and thanks in advance for looking at it whom ever does.
#include<stdio.h>
void datain(int, int[10000][3]);
void dataout(int, int[10000][3]);
void sortid( int, int *([3]), int);
void main()
{
int down, person[10000][3];
/*choose the size of table required*/
printf("Please enter the amount of the people required: \n\r");
scanf("%d",&down);
printf("Amount of people required: %d\n\r",down);
/*validate user input*/
while ((down <=0) || (down > 10000))
{
printf("please re-enter the number of people required:\n\r");
scanf("%d",&down);
}
/*Create database and input data*/
datain(down, person);
/*print out database unsorted*/
dataout(down, person);
/*sort the personnel ID array*/
sortid(down, person, array);
}
void datain( int numberofpeople, int *(person[3]), int array)
{
/*load up person arrays*/
int array1;
for (array1 = 1; array1 <= numberofpeople; array1 ++)
{
printf("\n\rPlease input the person identification: ");
scanf("%d",&person[array1][0]);
printf("Please input the person Wage: ");
scanf("%d",&person[array1][1]);
printf("Please input the person Sex(0 is male and 1 is female): ");
scanf("%d",&person[array1][2]);
/*validate user input*/
while ((person[array1][2] < 0) || (person[array1][2] > 1))
{
printf("please re-enter the sex data\n\r");
scanf("%d",&person[array1][2]);
}
printf("Please input the person Age: ");
scanf("%d",&person[array1][3]);
/*validate user input*/
while ((person[array1][3] < 16) || (person[array1][3] > 65))
{
printf("please re-enter the age data\n\r");
scanf("%d",&person[array1][3]);
}
}
}
/*print out database unsorted*/
void dataout (int number,int person[10000][3])
{
int array;
printf(" \n\r The Unsorted Data:\n");
printf(" ---------------------\n\r");
printf("Personnal ID Wage Sex Age\n\r");
for (array = 1; array <= number; array ++)
{
printf("%10d%10d%10d%10d\n\r",person[array][0],person[array][1],person[array][2],person[array][3]);
}
}/*here is the bit that goes wrong*/
void sortid( int number, int *(person[3]), int array)
/*select display from user*/
{
{
char words;
char nochmal;/* this means 'again' in german*/
nochmal = 1;
while (nochmal == 1)
printf("\n\rSelect your form of selection ?");
printf("\n\rAscending by Personnel ID,type id");
printf("\n\rAscending by Wage, type wage");
printf("\n\rAscending by Age, type age");
printf("\n\rFemale data only, print f");
printf("\n\rMale data only, print m\n\r");
scanf("\n%c",&words);
/*sort the array*/
register int index, array;
for (index = 1; index < number; -- index){
if (person[array-1][1] > person[array][1]) {
/* exchange elements */
index = person[array-1][1];
person[array-1][1] = person[array][1];
person[array][1] = index;
/*to resort the data*/
{
printf("Do you want to sort the database again? Yes (y) or No (n)");
scanf("%d",&nochmal);
}
}
}
}
}