C语言 结构体数组指针 与malloc内存分配的问题
C语言 结构体数组指针 与malloc内存分配的问题
日期:2015-12-02 21:55:10 人气:1
struct student *list;
int count = ReadStudentInfo("假设这是文件名", &list);
这个函数是这样被调用。
里面应该这样写
int ReadStudentInfo(const char* filename, struct student** pStudents)
{
*pStudents = (struct student*)malloc(sizeof(** pStudents) * n);//假