结构体套用二级指针

1.结构体套用二级指针

#define  _CRT_SECURE_NO_WARNINGS 
#include 
#include 
#include 

/*
"name1111"
"name2222"
"name3333"
*/

typedef struct Teacher
{
	//char student[10][30]
	char name[64];
	char *alisname;
	char **stuname; 
	int age ;
	int id;
}Teacher;

void printTeacher(Teacher *array, int num)
{
	int i = 0;

	for (i=0; i array[j].age)
			{
				tmp = array[i];  //=号操作  赋值操作
				array[i] = array[j];
				array[j] = tmp;
			}
		}
	}
}

Teacher * createTeacher01(int num)
{
	Teacher * tmp = NULL;
	tmp = (Teacher *)malloc(sizeof(Teacher) * num); //	Teacher		Array[3]
	if (tmp == NULL)
	{
		return NULL;
	}
	return tmp; //

}

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

2.内存模型

结构体套用二级指针_第1张图片

你可能感兴趣的:(dlog)