Tag: 不完整类型

c – 错误:“不允许不完整的类型”,IAR编译器

请指教,出了什么问题? 在.h struct { uint8_t time; uint8_t type; uint8_t phase; uint8_t status; } Raw_data_struct; typedef struct Raw_data_struct Getst_struct; void Getst_resp(Getst_struct Data); 在.c void Getst_resp(Getst_struct Data) //Here Error: incomplete type is not allowed { };

不完整数组类型的p 和* p的等价性

考虑以下代码(它是由于此讨论而产生的): #include void foo(int (*p)[]) { // Argument has incomplete array type printf(“%d\n”, (*p)[1]); printf(“%d\n”, p[0][1]); // Line 5 } int main(void) { int a[] = { 5, 6, 7 }; foo(&a); // Line 10 } GCC 4.3.4 抱怨错误消息: prog.c: In function ‘foo’: prog.c:5: error: invalid use of array with unspecified bounds GCC 4.1.2中的相同错误消息,似乎是-std=c99 , […]