First, in C ++ (but not in C), every struct or class names a type. Therefore, if you declare a struct connection_header , you also get the type connection_header , so you can later declare connection_header var some variable.
Then a typedef both C and C ++ requires a type and a name. For example:
typedef long my_number_type;
declares my_number_type as a synonym for long
As others pointed out, omit typedef
Basile starynkevitch
source share