Difference between 'struct' and 'typedef struct' in C++?

前端 未结 8 1650
忘了有多久
忘了有多久 2020-11-21 06:12

In C++, is there any difference between:

struct Foo { ... };

and:

typedef struct { ... } Foo;
8条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-21 06:47

    There is no difference in C++, but I believe in C it would allow you to declare instances of the struct Foo without explicitly doing:

    struct Foo bar;
    

提交回复
热议问题