typedef int DataType;
typedef struc{
DataType data[ListSize];
int length;
} Sqlist;
Sqlist*L和 Sqlist H 这两个定义变量有什么区别吗?
L.length=H.length吗?
2007-03-16 22:03

2007-03-16 22:06
2007-03-16 22:47
typedef struct
{
int i,j;
}seqlist;
void fun(seqlist *l)
{
l.i=1;
printf("%d",l.i);
}
int main(void)
{
seqlist l;
l.i=1,l.j=1;
fun(&l);
}
────────────────────────────────── Message ────────────────────────────────
Compiling D:\TURBOC2\NONAME.C:
•Error D:\TURBOC2\NONAME.C 7: Illegal structure operation in function fun
Error D:\TURBOC2\NONAME.C 8: Illegal structure operation in function fun
Warning D:\TURBOC2\NONAME.C 9: Parameter 'l' is never used in function fun
而这样不会有错误:
typedef struct
{
int i,j;
}seqlist;
void fun(seqlist l)
{
l.i=1;
printf("%d",l.i);
}
int main(void)
{
seqlist l;
l.i=1,l.j=1;
fun(l);
}
────────────────────────────────── Message ───────────────────────────────────
•Compiling D:\TURBOC2\NONAME.C:

2007-03-16 23:05
void fun(seqlist *l)是定义 L是指向结构体变量的指针
他是如何调用的 内部的变量
原始的上面程序是不是不正确的啊,书上也有错啊
2007-03-16 23:56
2007-03-17 00:21
哦,谢谢啊,解决我了一个大问题啊!!!
2007-03-17 00:36