【发布时间】:2020-04-14 18:35:52
【问题描述】:
我正在为大学做这个项目,他们给了我一个示例代码,可以在声明结构时使用,另一个是我如何使用 PowerPoint 和其他学习材料上的信息来声明它。
这是他们给我的代码:
typedef struct sala local, *plocal;
struct sala {
int id;
int capacidade;
int liga[3];
};
这是我做的另一个结构的代码:
typedef struct pessoa {
char id[15];
int idade;
char estado;
int dias;
} pessoa;
谁能给我解释一下区别?
在我的代码编辑器中,“local”和“*local”显示为蓝色。 (我使用 Netbeans)。
【问题讨论】:
-
Netbeans 是否也让
int和double显示为蓝色? -
typedef struct sala local, *local;无效:error: conflicting types for 'local' -
@FiddlingBits int 和 double 以蓝色和 local 显示,*local 以浅蓝色显示
-
在 typedef 中隐藏指针是一种非常糟糕的编程习惯
-
很容易错过阅读一些包含隐藏指针的代码。在使用变量的地方使用
*和/或&比隐藏在 typedef 中要好得多
标签: c data-structures struct typedef type-definition