指针和结构体补充
1.
1 #include "stdio.h" 2 #include "stdlib.h" 3 4 struct sector{ 5 char *pstr; 6 int strlen; 7 }; 8 9 struct arry{ 10 struct sector *parr; 11 int length; 12 }; 13 14 15 int main() 16 { 17 struct arry *p = malloc(sizeof(struct arry)); 18 p->length = 10; 19 p->parr = malloc(sizeof(struct sector)*p->length); 20 21 p->parr[0].strlen = 10; 22 p->parr[0].pstr = malloc(p->parr[0].strlen); 23 24 printf("zhangliang\n"); 25 return 0; 26 }