Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C 数组类型的元素类型不完整_C - Fatal编程技术网

C 数组类型的元素类型不完整

C 数组类型的元素类型不完整,c,C,我正在尝试这样做: typedef struct { float x; float y; } coords; struct coords texCoordinates[] = { {420, 120}, {420, 180}}; 但编译器不允许我:(此声明有什么问题?感谢您的帮助!请执行以下操作之一: typedef struct { float x; float y; } coords; coords texCoordinates[] = { {420, 1

我正在尝试这样做:

typedef struct {
    float x;
    float y;
} coords;
struct coords texCoordinates[] = { {420, 120}, {420, 180}};
但编译器不允许我:(此声明有什么问题?感谢您的帮助!

请执行以下操作之一:


typedef struct {
    float x;
    float y;
} coords;
coords texCoordinates[] = { {420, 120}, {420, 180}};

在C语言中,
struct
名称位于与
typedef
s不同的名称空间中

当然,您也可以使用
typedef-struct-coords{float x;float y;}coords;
并使用
struct-coords
coords
。在这种情况下,您选择什么并不重要,但对于自引用结构,您需要一个结构名称:

struct list_node {
    struct list_node* next; // reference this structure type - need struct name    
    void * val;
};
struct list_node {
    struct list_node* next; // reference this structure type - need struct name    
    void * val;
};