How can I hide the declaration of a struct in C?

前端 未结 6 1093
一整个雨季
一整个雨季 2020-12-05 01:13

In the question Why should we typedef a struct so often in C?, unwind answered that:

In this latter case, you cannot return the Point by value, sinc

6条回答
  •  春和景丽
    2020-12-05 01:45

    Old question, better answer:

    In Header File:

    typedef struct _Point Point;
    

    In C File:

    struct _Point
    {
       int X;
       int Y;
    };
    

提交回复
热议问题