C structs don't define types?

前端 未结 10 2320
离开以前
离开以前 2021-01-21 06:54

I\'ve just started learning C with a professional Java background and some (if no too much) C++ knowledge, and I was astonished that this doesn\'t work in C:

str         


        
10条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-21 07:04

    As far as I know, it shouldn't work without a typedef in C99 either (as this is simply the way C works), but it does work in C++ as a struct in C++ is just a class with all members public by default.

提交回复
热议问题