C语言疑惑
#include "stdio.h"
#include "malloc.h"
struct Student
{
int id;
char *name;
};
void errorFun()
{
struct Student arr[5];
struct Student *parr[5];
for(int i=0;i<5;i++)
{
struct Student stu;
stu.id=i;
stu.name="wq";
arr[i]=stu;
parr[i]=&stu;
}
}
void main()
{
errorFun();
}
#include "malloc.h"
struct Student
{
int id;
char *name;
};
void errorFun()
{
struct Student arr[5];
struct Student *parr[5];
for(int i=0;i<5;i++)
{
struct Student stu;
stu.id=i;
stu.name="wq";
arr[i]=stu;
parr[i]=&stu;
}
}
void main()
{
errorFun();
}