我真的很喜欢使用结构,因为它们使我的代码更整洁,但是我担心这段代码会使用很多结构
struct action {
int ex1 = 0;
int ex2 = 0;
int ex3 = 0;
int ex4 = 0;
};
struct state { // an array of the 'struct' action
action actions[10];
};
int main() {
state states[10];
}
该代码正确吗?
You might want to consider some type aliases (
typedef
/using
) instead, when you only have one member, but that's not always better.你可能还好
有很多类型并不是天生就不好。