Type alias. You can also define constants, variables, and compilation switches.
Both of them are the same in some cases.
However, define will be processed during pre-compilation for simple macro replacement. It will be replaced no matter whether it is correct or not. There will be no semicolons at the end, and even semicolons will be replaced together.
Typedef defines the alias in the defined type.
Typedef has a scope, and define can be used as long as it is defined
Typedef can not only define the built-in types of the system, but also define the user-defined type structure. The purpose of define is to take the alias of the definition type, as well as define constants, variables, and compilation switches.
Classic questions:
Const pint P; // P cannot be changed, but the content pointed to by P can be changed
Const pint P; // P can be changed, but the content pointed to by P cannot be changed.
Pint is a pointer type. Const pint P is used to lock the pointer. P cannot be changed.
The const pint P lock is the object referred to by the pointer p.