To
1 struct telphone{23 char name[]; 4 5 Char teinumber[]; 6 };
As an example, we first define a telphone structure.
Join needs to define an alias for Telphone:
Its syntax is
typedef Telphone TP;
And actually telphone as a struct,
It's better to write like this
Tepedef struck Telphone TP;
Because our telphone is our custom type, so we understand, but others do not necessarily understand, if we add struck this keyword, others will know that this is a custom type, and will not be confusing.
So it eventually evolved into
The following wording
struct telphone{ char name[]; Char telnumber[];} TP;
At this point, we can define
OK
struct Telphone TP1;
can also, directly
TP TP2;
If we don't need struct telphone, we can also directly
struct { char name[]; Char telnumber[];} TP;
This allows the structure to be defined only by TP.
The difference in C + +
If we define the
1 struct telphone{2 char name[]; 3 Char teinumber[]; 4 };
Then you can directly view the same telphone to define the structure variables.
Telphone TP1;
In C + +
struct Student { int A; }STU1; // STU1 is a variable
STU1 represents a struct variable of type student
and
typedef struct Student2 { int A; } STU2; // STU2 is a struct type =struct Student
There is no difference in the C language.
about struct and typedef structs