typedef a struct before it's declared

前端 未结 7 1951
死守一世寂寞
死守一世寂寞 2020-12-09 15:14

I\'m not a beginner, I\'m very familiar with the following idiom:

typedef struct Foo_ Foo;// I know typedef struct Foo Foo is fine, I\'m just trying to make          


        
7条回答
  •  星月不相逢
    2020-12-09 15:37

    Under certain circumstances, it is valid to use a struct ... type before it is declared. It is a so-called "incomplete type" then.

    For example, it is valid to declare a variable as a pointer to an "incomplete" struct, as well as (as you can see) a typedef.

提交回复
热议问题