#include <stdio.h>
#include <string.h>
#include <stdlib.h>
struct AGE
{
int year;
int month;
int day;
};
struct Student
{
char *name;
int num;
struct AGE birthday;
float score;
};
int main()
{
// 注意写法1与写法2 不能混用
// 写法1
struct Student* stu = NULL;
stu = (struct Student *)malloc(sizeof(struct Student));
(*stu).num = 12;
printf("%d
", (*stu).num);
// 写法2
struct Student *stu1 = (struct Student *)malloc(sizeof(struct Student));
stu1->name = "jack";
printf("%s
", stu1->name);
return 0;
}
“年轻时,我没受过多少系统教育,但什么书都读。读得最多的是诗,包括烂诗,我坚信烂诗早晚会让我邂逅好诗。”
by. 马尔克斯