
C C语言成长之路
weixin_39538253
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
75 结构体嵌套指针 上
75 结构体嵌套指针 上01 结构体嵌套指针 为该指针成员malloc结构体变量的地址和它的第一个成员的地址相等;psn的指针成员psn.name存储着一块指向地址为00995B30堆空间的内存。#include <stdlib.h>#include <stdio.h>typedef struct persons{ char* name; int age;}persons;void main() { persons psn; psn.name = (原创 2020-07-26 11:54:04 · 170 阅读 · 0 评论 -
74 结构体动态数组
74 结构体动态数组01 栈区 堆区 结构体数组#include <stdlib.h>#include <stdio.h>typedef struct persons{ char name[21]; int age;}persons;void main() { persons psn[3] = { {"何无忌",33}, {"刘毅",34},{"檀凭之",45} }; for (int i = 0; i < 3; i++) { printf("%原创 2020-07-25 23:25:28 · 619 阅读 · 1 评论 -
73 结构体变量赋值(未完成,结构体变量成员共28B(已经考虑对齐),实际36B)
1 同一结构体的变量互相赋值#include <stdlib.h>#include <stdio.h>typedef struct persons{ char name[21]; int age;}persons;void main() { persons psn = {"桓修",46}; persons psn2=psn; printf("%s\t%d\n", psn.name, psn.age); printf("%s\t%d\n", psn2.nam原创 2020-07-25 16:36:45 · 159 阅读 · 0 评论 -
71 结构体初始化
71 结构体初始化为什么UE4原码喜欢用->,因为.的话error或乱码,又不用strcpy01 结构体的成员列表赋值为字符串常量时#include <stdlib.h>#include <stdio.h>typedef struct persons{ char name[21]; int age;}persons;void main() { persons psn; //psn.name = "司马元显";//error //psn.name[原创 2020-07-25 13:41:50 · 138 阅读 · 0 评论 -
70 结构体定义
70 结构体定义01 四种结构体定义#include <stdlib.h>#include <stdio.h>//1struct persons01{ char name[21]; int age;};//2struct persons02{ char name[21]; int age;}psn02 = {"谢琰",46};//3struct{ char name[21]; int age;}psn03 = {"鲍陋",67};原创 2020-07-25 12:22:25 · 136 阅读 · 0 评论