#include <stdio.h> #include <string.h> struct tells;//声明结构体 struct info { char *infos; }; typedef struct Books { char *name; int page; struct info *pinfo; struct tells *tel; }BK; struct tells{ char *age; }; void pout(struct Books *b); void pouts(struct Books *b[], int n); int main(){ struct info str = {"信息内容描述"}; BK book1 = {"C鸳鸯",100,&str}; BK book2 = {"Java",200,&str}; BK *b = &book1; //定义结构体数组 BK arr_book[] = {book1, book2}; //定义一个指向结构体数组的结构体指针 BK *bookp = arr_book;//数组首地址就是指针地址 int i; for(i=0;i<2;i++){ pout(bookp+1); printf("******************************* "); } //定义结构体指针数组并初始化;里面全是结构体的地址 BK *arr_bookp[]= {b,&book2}; pouts(arr_bookp,2); return 0; } void pout(BK *b){ printf("name:%s page:%d info:%s ", b->name,b->page,b->pinfo->infos); } void pouts(BK *b[], int n){ printf("结构图体指针数组大小sizeof:%ld ",sizeof(b)); int i=0; for(;i<n;i++){ pout(b[i]); } }