#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 不能混用// 写法1struct Student* stu = NULL;stu = (struct Student *)malloc(sizeof(struct Student));(*stu).num = 12;printf("%d\n", (*stu).num);// 写法2struct Student *stu1 = (struct Student *)malloc(sizeof(struct Student));stu1->name = "jack";printf("%s\n", stu1->name);return 0;
}
转载于:https://www.cnblogs.com/jzsg/p/10946315.html