编辑代码

#include <stdio.h>

typedef struct head_st
{
    int a;
    int b;
    char c;
}HEAD_ST;


typedef struct head_all
{
    HEAD_ST st;
    int d;
    int e;
    char f;
}HEAD_ALL;



int main () {
    //JSRUN引擎2.0,支持多达30种语言在线运行,全仿真在线交互输入输出。 
    //printf("Hello world!     - c.jsrun.net.");

    HEAD_ALL test;
    memset(&test, 0, sizeof(HEAD_ALL));
    HEAD_ST *p = NULL;
    HEAD_ALL *pAll = NULL;

    test.st.a = 1;
    test.st.b = 2;
    test.st.c = '3';
    test.d = 4;
    test.e = 5;
    test.f = '6';

    p = (HEAD_ST *)(&test);
    pAll = (HEAD_ALL *)p;

    p->c = 't';

    //printf("%d %d %c", p->a, p->b, p->c);
    printf("%d %d %c %d %d %c", pAll->st.a, pAll->st.b, pAll->st.c, pAll->d, pAll->e, pAll->f);



    return 0;
}