what does typedef struct node *NODE indicate?

前端 未结 5 1837
遥遥无期
遥遥无期 2021-02-20 01:00
struct node
{
    int coef;

    int exp;

    struct node *link;
};

typedef struct node *NODE;
5条回答
  •  旧巷少年郎
    2021-02-20 01:09

    It defines NODE as a synonym for the type struct node *, so when you'll be declaring a variable of type NODE you'll be actually declaring a pointer to struct node.

    Personally, I don't think that such declaration is a good idea: you're "hiding a pointer" (which is almost always a bad idea), and, moreover, you are not highlighting this fact in any way into the new name.

提交回复
热议问题