|
#include <stdio.h>
#include <malloc.h>
struct Student{
int sid;
int age;
};
struct Student * CreateStudent();
void ShowStudent(struct Student *);
int main()
{
struct Student *ps;
ps = CreateStudent();
// free(ps);
ShowStudent(ps);
free(ps);
return 0;
}
struct Student * CreateStudent()
{
struct Student * p = (struct Student *)malloc(sizeof(struct Student));
p->age = 88;
p->sid = 99;
// free(p);
return p;
}
void ShowStudent(struct Student *pst)
{
printf("%d %d\n",pst->sid,pst->age);
}
小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)
GMT+8, 2024-5-3 07:44
Powered by Discuz! X3.4
© 2001-2023 Discuz! Team.