C 不同类型的结构

C 不同类型的结构,c,struct,C,Struct,我知道struct和前面有typedef关键字的struct之间的区别。参考资料如下: vs 但这两种类型之间的区别是什么: struct point { int x; int y; }; vs 还有一点: typedef struct set_t{ int count; void **values; } *SetRef; 这是什么类型的 struct point { int x; int y; }; 这声明了一个新类型struct

我知道struct和前面有typedef关键字的struct之间的区别。参考资料如下:

vs

但这两种类型之间的区别是什么:

struct point {
   int x;
   int y;
};
vs

还有一点:

    typedef struct set_t{    
      int count;
      void **values;
   } *SetRef;
这是什么类型的

struct point { int x; int y; };
这声明了一个新类型
struct point
,其中包含两个
int
成员
x
y

struct point { int x; int y; } my_point;

这还声明了一个新类型
struct point
,其中包含两个
int
成员
x
y
,并声明了类型
struct point
的对象
my_point

myu-point
是一个类型为
struct-point
的变量,第一个变量声明一个
struct
类型,而第二个变量同时声明类型和实例
myu-point
。换句话说,
my_-point
不是一个类型,而是一个实际的
struct-point
实例。

在第二个例子中,您还从type
struct-point

定义了一个变量(名为
my_-point
),第一个变量只声明了结构。以后必须使用它来创建它的对象。 第二个同时声明了它的结构和对象

    typedef struct set_t{    
      int count;
      void **values;
   } *SetRef;
struct point { int x; int y; };
struct point { int x; int y; } my_point;