c指针

struct a (*prt_a)[80];

(*prt_a)[0] ... (*prt_a)[79]:80个结构体变量.

struct a *prt_a[80];

prt_a[0]....prt_a[79]: 存放了指向结构题变量的指针

 

代码片段(保存记忆).

 

int test(student_t **t)
{
    //t->p = (class_t *)malloc(sizeof(class_t));
    *t = (student_t*)malloc(sizeof(student_t) *2);
    memset(*t, 0x00, sizeof(student_t)*2);
    //memset(*t, 0, sizeof(student_t));
    (*t)[0].age = 18;
    memcpy((*t)[0].name, "zhangsan", 10);
    (*t)[1].age = 19;
    memcpy((*t)[1].name, "lisi", 10);
}

你可能感兴趣的:(C++,c,C#)