error: invalid type argument of unary '*' (have 'int')
struct test_t {
int var1[5];
int var2[10];
int var3[15];
}
test_t* test;
test->var1[0] = 5;
我该如何解决这个问题?
最佳答案
你应该写:
struct test_t* test;
或者使用typedef
如果您想避免每次声明该类型的变量时都编写 struct
:
typedef struct test_t {
int var1[5];
int var2[10];
int var3[15];
} test_t;
test_t* test;
旁注:在 C++ 中,结构名称位于常规命名空间中,因此在声明该类型的变量之前无需编写 struct
。
关于c - 错误 : invalid type argument of unary '*' (have 'int' ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20656874/