malloc(sizeof(char *)*n)模型

#define  _CRT_SECURE_NO_WARNINGS   
#include   
#include   
#include  
typedef struct Teacher  
{  
    //char student[10][30]  
    char name[64];  
    char *alisname;  
    char **stuname;   
    int age ;  
    int id;  
}Teacher; 
int createTeacher02(Teacher **pT, int num)  
{  
    int i = 0, j = 0;  
    Teacher * tmp = NULL;  
    tmp = (Teacher *)malloc(sizeof(Teacher) * num); //  Teacher     Array[3]  
    if (tmp == NULL)  
    {  
        return -1;  
    }  
    memset(tmp, 0, sizeof(Teacher) * num);  
  
    for (i=0; i

你可能感兴趣的:(malloc(sizeof(char *)*n)模型)