结构体嵌套结构体(结构体嵌套结构体变量(本身和外部),结构体嵌套结构体指针变量(本身))

    技术2025-04-29  19

    结构体嵌套外部结构体变量

    #include<stdio.h> #include<string.h> #include<stdlib.h> typedef struct student { int score[10]; int data; } A; struct node { int i; A P; } B; int main() { return 0; }

    结构体嵌套本身结构体变量--------错误!!

    #include<stdio.h> #include<string.h> #include<stdlib.h> typedef struct student { int score[10]; int data; } A; typedef struct node { int i; A P; struct node l; } B; int main() { return 0; }

    结构体嵌套结构体指针变量本身可以

    #include<stdio.h> #include<string.h> #include<stdlib.h> typedef struct student { int score[10]; int data; } A; typedef struct node { int i; A P; struct node *next; } B; int main() { return 0; }

    Processed: 0.018, SQL: 9