結構體對象地址與第一個成員的關係

兩者的關係是相等的

#include<cstdio>
typedef  struct node{
    struct node *head;
    struct node *tail;
}Node;
typedef struct  two{
    Node Str_Que;
    int k;
}Test;
int main()
{
    Node root;
    Test body;
    root.tail=&body.Str_Que;
    //驗證Test地址和&body.Str_Que;
    printf("Test:%p\n",&body);

    printf("Node:%p\n",root.tail);
    return 0;
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章