黑马程序员技术交流社区
标题:
结构体嵌套定义
[打印本页]
作者:
i_iOS
时间:
2015-10-4 11:15
标题:
结构体嵌套定义
#include<stdio.h>
int main(){
struct son{
char *name;
char *gender;
int *age;
};
struct wife{
char *name;
int age;
struct son son;
};
struct wife wife1={"heimaketang",20,{"shuangyuanban","male",2}};
printf("妻子的名字是%s,年龄是%d,她的孩子是%s,性别是%s,年龄是%d\n",wife1.name,wife1.age,wife1.son.name,wife1.son.gender,wife1.son.age);
return 0;
}
复制代码
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/)
黑马程序员IT技术论坛 X3.2