프좆밥이 과제하다 배열부분 질문이 있습니다

아래부분이 제가 작성한 코드인데 밑에 빨간색으로 표시한 부분을 bmi결과값에 따라 내림차순으로 출력해야 되는데

구조체에 name~bmi부분을 하나의 그룹으로 보고 버블소팅을 해서 정렬하려 했는데

자꾸 오류가 나서 프갤 형들 도움을 받고 싶습니다.

정답이 아닌 방향만이라도 제시해 주시면 감사하겠습니다.

그리고 이름 입력할 때 띄어쓰기 입력시키려고 gets()를 썼는데 이게 실행은 되는데 컴파일러가 gets()위험하니까 웬만하면

쓰지말라고 경고보내는데 gets 안쓰면 뭘로 대체해야 하나요??

프좆밥이라 좀 열심히 해보려고 해도 교수는 학원다니란 소리나하고 답답합니다.

책도 찾아보고 했는데 도저히 해결이 안되어 여기에 올립니다.


#include <stdio.h>
#define SIZE 4

float cal(float h, float w);

struct nahw
{
    char name[9];
    int age;
    float height, weight, bmi;
};

int main(void)
{
    struct nahw list[SIZE];
    int i;

    for(i=1; i<SIZE; i++)
    {
    printf("[member %d] name   : ", i);
    gets(list[i].name);
    printf("[member %d] age    : ", i);
    scanf("%d", &list[i].age);
    printf("[member %d] height : ", i);
    scanf("%f", &list[i].height);
    printf("[member %d] weight : ", i);
    scanf("%f", &list[i].weight);
    printf("----------------------------\n");
    getchar();
    }

    printf("------------list------------\n");

    for(i=1; i<SIZE; i++)
    {
    printf("----------------------------\n");
    printf("[member %d] name   : %s\n

[member %d] age    : %d\n

[member %d] height : %.1f\n

[member %d] weight : %.1f\n

[member %d] bmi    : %.1f\n"

, i, list[i].name, i, list[i].age, i, list[i].height, i, list[i].weight, i, cal(list[i].height, list[i].weight));

    }

}
float cal(float h, float w)
{
    return((10000 * w) / (h * h));