C&C++ type definition typedef

1. Statement

1.1 Structure declaration:

1     struct {
2         int n;
3         double x,y;
4     };

 

1.2 Declaration with Structure Flags

1     struct point{
2         double x,y;
3     };

1.3 Defining Structure Types

1.3.1 Without Structure Mark

typedef struct{
    POINT center;
    double radius;
}CIRCLE;

1.3.2 With structure flag  

typedef struct Node{
    int data;
    struct Node *next;
}Node;

 

2. Define structure variables

1  struct point pt1,pt2;   The description form of struct point is also treated as a type

1     struct {
2         int n;
3         double x,y;
4     }st1, st2;

3 Summary

3.1 Structural signs

  struct Node is equivalent to struct {....}

3.2   typedef

       typedef struct Node Node; Node replacement struct Node for

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325284805&siteId=291194637