Search code examples
cstructtypedefc89

C90 and typedef


I had struct point {(...)}; defined. But with C90 it seems I have to do it with typedef. How do I do this correctly? typedef struct point {} point;? typedef struct {} point;? typedef struct point {};?


Solution

  • You can do:

    typedef struct Point { ... } MyPoint;
    

    and then use both kinds of declarations:

    struct Point p1;
    MyPoint p2;