Correct following program.
The function sort_by_height sorts an array of the structure person in ascending order, which represents a personal physical datum for each person.
struct person { char name[64]; double height, weight; }; void swap(double *a, double *b) { double tmp; tmp = *a; *a = *b; *b = tmp; } void sort_by_height(struct person p[], int size) { int min, i, j; for (i = 0; i < size-1; i++) { min = i; for (j = i+1; j < size-1; j++) { if (p[j].height < p[min].height) { min = j; } } swap( p[j].height, p[min].height); } }