#include<stdio.h> #include<stdlib.h> struct stu { int id; int age; char name[128]; }; /* struct heima_stu { int id; int age; char names[128]; int chinese; int match; };*/ //可以这样定义上面那个结构体 struct heima_stu { struct stu s; //定义一个stu的结构体变量 int chinese; int math; }; int main (void) { //定义一个struct hei_mastu的结构体变量 struct heima_stu heima; //init the struct heima.s.age = 10; heima.s.id = 11; strcpy(heima.s.name, "shun"); heima.chinese = 111; heima.math = 222; printf("%d , %d , %s , %d ,%d", heima.s.age, heima.s.id, heima.s.name,heima.chinese, heima.math); return 0; }
10 , 11 , shun , 111 ,222
标签:heima,struct,chinese,stu,--,体套,C语言,int,id From: https://www.cnblogs.com/shunguo/p/16840051.html