发布网友 发布时间:2022-04-20 17:24
共1个回答
热心网友 时间:2023-10-03 07:17
//给空值
ppaas = NULL;
//申请空间
ppaas =(PPAAS)new aa *[500];//new以后,这个空间(数组)存放500个指针,ppaas 指向这个空间,使用时需要再对每个元素去分配内存。
//比如
(*ppaas)[0] = new aa;
(*ppaas)[0]->age = 100;
(*ppaas)[0]->name = "sdfsdf";
//---------------------------------------------------
ppbbs = NULL;
ppbbs =(PPBBS)new PBB[500];
(*ppbbs)[0] = new BB;
(*ppbbs)[0]->aacount = 100;
(*ppbbs)[0]->pbbs[0] =new BB;
(*ppbbs)[0]->pbbs[0]->aacount = 101;
(*ppbbs)[0]->pbbs[0]->pbbs[0] = NULL;
(*ppbbs)[0]->pbbs[0]->pbbs[1] = NULL;
(*ppbbs)[0]->pbbs[1] = new BB;
(*ppbbs)[0]->pbbs[1]->aacount = 101;
(*ppbbs)[0]->pbbs[1]->pbbs[0] = NULL;
(*ppbbs)[0]->pbbs[1]->pbbs[1] = NULL;
(*ppbbs)[0]->pbbs[2] = NULL;
(*ppbbs)[1] = NULL;