摘要: #include<stdio.h> #include<string.h> //使用匿名结构体嵌套 struct person1 { const char* name; char gender[20]; struct { int age; }; }p1; //不使用匿名结构体嵌套 struct pho 阅读全文
posted @ 2020-04-06 20:17 Axuanup 阅读(890) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h> #include<string.h> /* struct 类型名 { 类型 变量名; 类型 变量名; }tpye_name1,tepy_name2; //tpye_name1,tepy_name2为具体变量名,使用时无需再声明结构体了 */ struct Game 阅读全文
posted @ 2020-04-06 18:22 Axuanup 阅读(221) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h> //tpyedef 关键字有什么用,我们每次使用结构体的时候,都要加,struct 这个关键字 //使用tepydef 关键字我们给struct关键字给定义个别名,这样我们定义的时候就不用加struct 这个关键字了 /* 定义方式 typedef struct 阅读全文
posted @ 2020-04-06 18:08 Axuanup 阅读(510) 评论(0) 推荐(0) 编辑
摘要: 1 #include<stdio.h> 2 3 //结构体关键字struct 4 //定义一个游戏玩家的NPC 5 struct Gamer 6 { 7 char cName[24]; //玩家名称 8 int nHealth; //生命值 9 int nMagic; //魔法 10 int nSk 阅读全文
posted @ 2020-04-06 17:41 Axuanup 阅读(923) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h> int strlen(char* p);//获取字符串的长度 void strcpy(char* des, char* src); //字符串拷贝 char strcat(char* des, const char* stc); //字符串拼接 //字符串拷贝 v 阅读全文
posted @ 2020-04-06 17:06 Axuanup 阅读(224) 评论(0) 推荐(0) 编辑