请教结构体问题!
cup51 2006-03-20 11:37:49 int* list=(int*)malloc(sizeof(int)*x);
按照以上的方法,我定义了一个数组,但是其类型是结构体,就是比如
struct stu
{
int x;
int y;
};
然后再定义
struct stu * list=(int*)malloc(sizeof(int)*x);
这在函数中怎么保证每次调用时期原来的值不被覆盖刷新阿?
要是int类型,直接static int 一个变量就行了
但是像这种结构体的我直接在前面加就出问题了,就是
static struct stu * list=(int*)malloc(sizeof(int)*x);这样错了,
怎么办?