Typedef can be used to define your own data types, but I always forget to use the format, which is easy to confuse with # define. Today I suddenly think of how to write typedef is not easy to write wrong.
For example, if I want to define a double type variable real, it is written as double real; this beginner C language will; at this time, I only need to add a typedef before this statement to change it to typedef double real; real is defined as a new type instead of a variable. The new custom type is actually double.
Another example is:
Double real [20];
-->
Typedef double real [20];
Real is defined as a new type, which is an array type with 20 double data types. You can use the following:
Real height, longth;
Then, height longth is an array of the double type with 20 elements.
Double height [20], longth [20];
The effect is the same, but it looks more concise.
Double * doublepointer; doublepointer is a pointer to the double type.
-->
Typedef double * doublepointer;
The doublepointer is defined as a new type. It is easy to define a pointer to the double type:
Doublepointer dptr;