定义的区别.
struct student *head,stu;等价于struct student *head; struct student *stu;
struct student *head,*stu;为什么却是struct student *head;*stu;??
[解决办法]
struct student *head,stu;不等价于struct student *head; struct student *stu;
它是等价与struct student *head; struct student stu;
[解决办法]
同上
[解决办法]
楼主的结论和问题不正确
看下面的例子
#include <iostream.h>
struct input1
{
int i, j;
}input1;
int main()
{
struct input1 *a, b;
a = new struct input1;
a-> i = 1;
b.i = a-> i;
cout < <a-> i < <endl < <b.i < <endl;
return 1;
}
你就知道了
[解决办法]
同上
[解决办法]
struct student *head,stu;等价于struct student *head; struct student *stu;
==》
struct student *head,stu;等价于struct student *head; struct student stu;
struct student *head,*stu;为什么却是struct student *head;*stu;??
==》
struct student *head,*stu;等价于struct student *head; struct student *stu;
[解决办法]
这是多个变量放在一起定义,
它们相对独立,并没有关联关系,
跟分别定义没有两样!