结构体应用三

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

static struct s1
{
    char c[4];
    char* s;
}s1 = {"abc","def"};


static struct s2
{
    char* cp;
    struct s1 ss1;
}s2 = {"ghi","jkl","mno"};


int main()
{
    printf("%c,%c\n",s1.c[0],*s1.s);
    printf("%s,%s\n",s1.c,s1.s);

    printf("%s,%s\n",s2.cp,s2.ss1.s);
    printf("%s,%s\n",++s2.cp,++s2.ss1.s);

    return 0;
}

 

posted @ 2021-10-04 15:15  卷哭你  阅读(60)  评论(0编辑  收藏  举报