摘要: 共用体: 多个变量(不同的数据类型)共用同一块内存空间, 但是同一时刻, 只能有一个变量起作用 共用体中起作用的的成员是最后一次存放的成员 #include<stdio.h>#include<stdlib.h> //define union union myUnion{ char a; short 阅读全文
posted @ 2022-10-29 22:54 朵朵奇fa 阅读(134) 评论(0) 推荐(0) 编辑
摘要: #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 chin 阅读全文
posted @ 2022-10-29 22:19 朵朵奇fa 阅读(18) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h> #include<stdlib.h> struct stu { int id; int age; char name[128]; }; int main (void) { //结构体数组: 数组中的每一个元素都是结构体 struct stu num[5] = {{ 阅读全文
posted @ 2022-10-29 22:06 朵朵奇fa 阅读(97) 评论(0) 推荐(0) 编辑
摘要: 只有当定义了结构体变量的时候才会分配内存空间, 比喻说 struc stu { int id; int age; char name[28]; } struct stu d; 这个时候才会分配内存空间 (1) 定义结构体类型, 以及初始化结构体变量 #include<stdio.h> //关键字 s 阅读全文
posted @ 2022-10-29 18:12 朵朵奇fa 阅读(74) 评论(0) 推荐(0) 编辑