黑马程序员技术交流社区

标题: iOS技术交流 [打印本页]

作者: 醉叶惜秋    时间: 2015-11-12 00:59
标题: iOS技术交流
大神们帮我看看下面那个被注释的地方错在哪了?谢谢
#include <stdio.h>
int main(){

    struct parents{
   
        char *name;
        int age;
   
   
    };
   
   
    struct family{
   
        char *name;
        int age;
        char *statue;
        struct parents grendfather;
   
    };
   
    struct family father={"夏父亲",30,"爸爸",{"夏爷爷",50}};
    //father.grendfather={"夏爷爷",50};
    struct family mother={"夏母亲",26,"妈妈"};
    struct family son={"夏儿子",1,"宝宝"};
    struct family *p=&father;
    struct family *p1=&mother;
    struct family *p2=&son;
    struct family *p3=&father;
    printf("姓名=%s\t年龄=%d\t身份=%s\n",(*p).name,(*p).age,(*p).statue);
    printf("姓名=%s\t年龄=%d\t身份=%s\n",(*p1).name,(*p1).age,(*p1).statue);
    printf("姓名=%s\t年龄=%d\t身份=%s\n",(*p2).name,(*p2).age,(*p2).statue);
    printf("姓名=%s\t年龄=%d\t\n",(*p3).grendfather.name,(*p3).grendfather.age);

}

作者: hei军    时间: 2015-11-13 00:57
有点看不懂




欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2