帮忙看看是哪里的问题,我一直找不出来。。
程序代码:#include <iostream>
#include <stdlib.h>
using namespace std;
struct Teacher
{
int age;
};
int getTeacher(Teacher **p)
{
if(p == NULL)
{
return -1;
}
Teacher *temp;
temp = (Teacher *)malloc(sizeof(Teacher));
if(temp = NULL)
{
return -1;
}
temp->age = 23;
*p = temp;
return 0;
}
int main()
{
Teacher *pt = NULL;
getTeacher(&pt);
cout << "pt->age=" << pt->age << endl;
cout << "Hello world!" << endl;
system("pause");
return 0;
}






