C++程序设计语言练习5.3 typedef的使用

来源:互联网 发布:淘宝可以寄到台湾吗 编辑:程序博客网 时间:2024/06/08 02:39

  1. 定义类型unsigned char
  2. 定义类型const unsigned char
  3. 定义类型到整数的指针
  4. 定义类型到字符的指针的指针
  5. 定义类型到字符数组的指针
  6. 定义类型7个到整数的指针的数组
  7. 定义类型到包含7个到整数的指针的数组的指针
  8. 定义类型包含8个数组的数组,其中每个数组包含7个到整数的指针
typedef unsigned char UnsignedChar;typedef const unsigned char ConstantUnsignedChar;typedef int* IntegerPointer;typedef char** PointerPointerChar;typedef char* PointerArrayChar;typedef InterPointer Array7IntegerPointer[7];typedef Array7IntegerPointer* PointerArray7IntegerPointer;typedef IntegerPointer Array8Array7IntegerPointer[8][7];

使用原则:
使用typedef定义的类型需要使用特征显亮的名字,不应该使用含混晦涩的名字,过多的使用typedef有可能导致类型混乱。



0 0
原创粉丝点击