为什么node * left,* right而不是node * left,right? [重复]

时间:2021-03-29 09:30:34

This question already has an answer here:

这个问题在这里已有答案:

The type of left and right is node* so like other types they should be declared as node* left,right; Example int a,b;

左边和右边的类型是node *,所以像其他类型一样,它们应该被声明为node * left,right;示例int a,b;

2 个解决方案

#1


1  

You have to pick one way or the other, and this way is less awful. For an example of how awful the other way would be, compare:

你必须选择一种方式,这种方式不那么糟糕。有关另一种方式有多糟糕的例子,请比较:

int a[10], b[20], c[30];

to

int[10] a;
int[20] b;
int[30] c;

#2


0  

When programming in C, if you get in the habit of attaching the * to the variable names it will make more sense to you.

当用C编程时,如果你养成了将*附加到变量名的习惯,那么你就会更有意义。

int *i,j;

i is an int* and j is an int.

我是一个int *,j是一个int。

#1


1  

You have to pick one way or the other, and this way is less awful. For an example of how awful the other way would be, compare:

你必须选择一种方式,这种方式不那么糟糕。有关另一种方式有多糟糕的例子,请比较:

int a[10], b[20], c[30];

to

int[10] a;
int[20] b;
int[30] c;

#2


0  

When programming in C, if you get in the habit of attaching the * to the variable names it will make more sense to you.

当用C编程时,如果你养成了将*附加到变量名的习惯,那么你就会更有意义。

int *i,j;

i is an int* and j is an int.

我是一个int *,j是一个int。