Chinaunix首页 | 论坛 | 博客
  • 博客访问: 4625350
  • 博文数量: 671
  • 博客积分: 10010
  • 博客等级: 上将
  • 技术积分: 7310
  • 用 户 组: 普通用户
  • 注册时间: 2006-07-14 09:56
文章分类

全部博文(671)

文章存档

2011年(1)

2010年(2)

2009年(24)

2008年(271)

2007年(319)

2006年(54)

我的朋友

分类: C/C++

2007-08-21 14:59:49

在标准C中  
  因为一个struct要用到的时候,必须带这struct限定词  
  eg.  
  struct   tagstudent  
  {  
        int   studentID;  
        char   studentName[256];  
  };  
   
  以后使用该定义的时候,你得  
  struct   tagstudent   students[5];  
  得带着个struct才行  
  所以大家为了方便,就这样写  
  typedef   struct   tagstudent  
  {  
        int   studentID;  
        char   studentName[256];  
  }student;  
   
   
  以后只要想定义这个结构  
  student   students[5];  
  就ok了。  
   
  但是在C++的语法里,struct定义后就不需要在定义的时候带着struct了  
   
  所以typedef也就失去了它应有的作用   
   
阅读(923) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~