判断学生成绩是否及格

为社么这里要使用malloc函数
#include <stdio.h>
#include <stdlib.h>
typedef struct student{
    int num;
    char name[20];
    char sex;
    float score;
}student;
void check(student *stu)
{
    student *p;
    printf("不及格的成绩如下:"); 
    for(p=stu;p<stu+3;p++)
        if(p->score<60) 
            printf("%d %s %c %.2f\n",p->num,p->name,p->sex,p->score);
}
int main()
{
    student *p;
    int i;
    p=(student *)malloc(sizeof(student)*5);
    printf("请输入学生成绩:");
    for(i=0;i<3;i++) 
        scanf("%d%s%*c%c%f",&(p+i)->num,(p+i)->name,&(p+i)->sex,&(p+i)->score);
        check(p);
        free(p);
    return 0;
}

使用指针前需要提前申请好资源空间大小,malloc是申请了一个void类型的指针,申请号后需要再给它定义指针类型