Type alias: It is a name, which is a synonym for a certain type. Using type aliases can simplify complex type names , make them easy to understand and use , and help programmers clearly know the true purpose of the type.
Two ways to use type aliases:
typedef int length; // length是int的别名
using width = float; // width是float的别名
Note:
When the type alias refers to a composite type or constant, as follows:
typedef char* pstring;
const pstring cstr = 0; // cstr是指向char的常量指针
const char* cstr_01 = 0; // cstr_01是指向const char的指针
const pstring* ps; // ps是指向char的常量指针的指针
Don't confuse the second line with the third line. When using typedef to alias the composite type, char* is a whole , so the second line const is modified by char *; the third line const is modified by char .