Can I name a variable with the same name as a typedef'd structure name?

后端 未结 5 1040
北荒
北荒 2020-12-20 14:14

Here is the structure declare code.

struct list_el {
    int val;
    struct list_el * next;
};

typedef struct list_el item;

And when I

5条回答
  •  [愿得一人]
    2020-12-20 15:04

    A typedef is just a new name for an already existing type. defines are handled by the preprocessor while typedefs are handled by the C compiler itself. [copied from this link]

    check this question: Are typedef and #define the same in c?

提交回复
热议问题