0

I've noticed something interesting. I want to make sure of it and discuss about it:

These two are not the same:



    typedef struct str_type structure
    struct str_type{
       int x;
       int y;
       unsigned int z;
       uint8_t ui;
    };
    //-----------------------
    typedef struct str_type{
       int x;
       int y;
       unsigned int z;
       uint8_t ui;
    } structure;

In the first case by writing structure, we actually write struct str_type. In the second case by writing structure, we are actually writing a whole daclaration



    struct str_type{
       int x;
       int y;
       unsigned int z;
       uint8_t ui;
    }

ilgaar
  • 804
  • 1
  • 12
  • 31
  • possible duplicate of [Why should we typedef a struct so often in C?](http://stackoverflow.com/questions/252780/why-should-we-typedef-a-struct-so-often-in-c) – Degustaf Feb 24 '15 at 21:34
  • possible duplicate of [Difference between 'struct' and 'typedef struct' in C++?](http://stackoverflow.com/questions/612328/difference-between-struct-and-typedef-struct-in-c) – Hannes Feb 24 '15 at 21:58

0 Answers0