In C ++ there is no difference, there is a difference in pure C. And in C ++ it is used rather as a relic of C. There are 4 types of namespaces in C language: 1) Labels (used in goto constructions) 2) Tags (names of structures, unions and enumerations) 3) Members of structures and unions 4) Everything else (names of functions, objects, constants and all typedefs) .
The C standard also requires ( C11 6.2.3 ) a separate namespace for each of these categories. Well, all compilers and IDE generally support this standard. That is, all these elements are created in different namespaces. Therefore, for example, such code
struct myStruct {}; myStruct str;
will not compile by the C compiler (but compiled by C ++), because the type myStruct is in a separate namespace (not the one in which the str variable is created). To make this code work, str should be declared like this:
struct myStruct str;
In order not to write the word struct before each variable declaration, you can use the method with typedef. Because Since everything that is declared via typedef is placed in a more general namespace (in the same as all other objects), now there is no need to write the word struct before each declaration.