What are the differences between these two typedef styles in C?

后端 未结 6 1268
野趣味
野趣味 2021-01-11 14:24

I\'m curious what the difference here is when typedefing an enum or struct. Is there any difference semantically between these two blocks?

This:

typ         


        
6条回答
  •  一生所求
    2021-01-11 14:59

    The only real difference is that in the second case, you can use something like:

    enum SomeEnum x;
    

    whereas the first only supports:

    SomeEnum x;
    

    To people who've been writing C a long time, defining a struct without the struct keyword often "feels" strange...

提交回复
热议问题