You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
706 B
26 lines
706 B
#include "mysyslib.h"
|
|
|
|
ss* init(int Nums){
|
|
ss* stu = (ss*)malloc(sizeof(ss));
|
|
if(!stu) return NULL;
|
|
|
|
stu->nums = 0;
|
|
stu->student = (Student*)malloc(sizeof(Student)*Nums);
|
|
if(!stu->student) return NULL;
|
|
|
|
for(int i = 0; i < Nums; ++i){
|
|
stu->student[i].id = (char*)malloc(sizeof(char)*6);
|
|
stu->student[i].clas = (char*)malloc(sizeof(char)*4);
|
|
stu->student[i].name = (char*)malloc(sizeof(char)*20);
|
|
}
|
|
return stu;
|
|
}
|
|
|
|
Student *newStudent(){
|
|
Student *stu = (Student*)malloc(sizeof(Student));
|
|
stu->id = (char*)malloc(sizeof(char)*6);
|
|
stu->clas = (char*)malloc(sizeof(char)*4);
|
|
stu->name = (char*)malloc(sizeof(char)*20);
|
|
return stu;
|
|
}
|