Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what does typedef struct node *NODE indicate?

Tags:

c

struct node
{
    int coef;

    int exp;

    struct node *link;
};

typedef struct node *NODE;
like image 678
Skr Avatar asked Oct 29 '11 19:10

Skr


2 Answers

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.

like image 93
Matteo Italia Avatar answered Oct 03 '22 23:10

Matteo Italia


It makes NODE a typedef for a struct node *.

like image 27
Joey Avatar answered Oct 04 '22 00:10

Joey