BK arr_book[] = {book1, book2}; //定义一个指向结构体数组的结构体指针 BK *bookp = arr_book;//数组首地址就是指针地址 inti; for(i=0;i<2;i++){ pout(bookp+1); printf("***\n"); } //定义结构体指针数组并初始化;里面全是结构体的地址 BK *arr_bookp[]= {b,&book2}; pouts...
定义结构体指针并初始化 #include<iostream> using namespace std; struct MM { char name[20]; int age; }; int main() { MM *p = new MM; *p = {"宝贝",18}; MM *pp = new MM{ "哈哈",20 }; cout << p->name <<"\t"<age<< endl; cout << pp->name << "\t" << pp->ag...