工作了才知道,原来c语言也还如此陌生,只知道一些常用的用法,却对稍微有点不常见的就不清楚了,从今天起,开始整理!
The formula to follow is: typedef [attributes] DataType AliasName;
example:
typedef short SmallNumber;
typedef unsigned int Positive;
typedef double* PDouble;
typedef string FiveStrings[5];
mean:
In typedef short SmallNumber, SmallNumber can now be used as a data type to declare a variable for a small integer.
In the second example, typedef unsigned int Positive, The Positive word can then be used to declare a variable of an unsigned int type.
After typedef double* PDouble, the word PDouble can be used to declare a pointer to double.
By defining typedef string FiveStrings[5], FiveStrings can be used to declare an array of 5 strings with each string being of type string.