#include<stdio.h>
#include<string.h>
typedef struct
{
char name[20];
int math;
int eng;
int db;
} student;
student setzero(student stu)
{
//memset(&stu, 0, sizeof(student));
stu.math = 0;
stu.eng = 0;
stu.db = 0;
return stu;
}
student *setzero2(student *stu)
{
//memset(stu, 0, sizeof(student));
stu->math = 0;
stu->eng = 0;
stu->db = 0;
return stu;
}
int main(void)
{
student stu = {"AAA",1,2,3};
printf("%s %d %d %d\n", stu.name, stu.math, stu.eng, stu.db);
stu = setzero(stu);
printf("%s %d %d %d\n", stu.name, stu.math, stu.eng, stu.db);
student stu2 = {"BBB",11,22,33};
printf("%s %d %d %d\n", stu2.name, stu2.math, stu2.eng, stu2.db);
setzero2(&stu2);
printf("%s %d %d %d\n", stu2.name, stu2.math, stu2.eng, stu2.db);
return 0;
}