Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1567620
  • 博文数量: 354
  • 博客积分: 8137
  • 博客等级: 中将
  • 技术积分: 5137
  • 用 户 组: 普通用户
  • 注册时间: 2009-11-26 15:40
文章分类

全部博文(354)

文章存档

2010年(300)

2009年(54)

分类: C/C++

2010-07-10 00:34:05

A typedef declaration introduces a name that, within its scope, becomes   a   synonym for the type given by the decl-specifiers portion of the declaration.   In   contrast   to   the   class,   struct,   union,   and   enum   declarations,   typedef   declarations   do   not   introduce   new   types   —   they   introduce   new   names   for   existing   types.

Example

//   Example   of   the   typedef   keyword
typedef   unsigned   long   ulong;

ulong   ul;           //   Equivalent   to   "unsigned   long   ul; "

typedef   struct   mystructtag
{
      int       i;
      float   f;
      char     c;
}   mystruct;

mystruct   ms;       //   Equivalent   to   "struct   mystructtag   ms; "

typedef   int   (*funcptr)();     //   funcptr   is   synonym   for   "pointer
                                                      //         to   function   returning   int "

funcptr   table[10];       //   Equivalent   to   "int   (*table[10])(); "
阅读(918) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~