#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