zoukankan      html  css  js  c++  java
  • 【转载】C++中结构体的声明和定义

    http://blog.csdn.net/whuslei/article/details/5665289

    //定义一个结构体,类型为struct Student
    struct  Student     
    {
        string name;
        double eng;
        double ch;
    }; 
     
    //定义了一个结构体,类型为struct Student;且定义了一个结构体实例,名叫Stu
    10  struct  Student    
    11  {
    12      string name;
    13      double eng;
    14      double ch;
    15  }Stu; 
    16   
    17  //定义了无名的结构体,且定义了一个结构体实例,名叫Stu
    18  struct 
    19  {
    20      string name;
    21      double eng;
    22      double ch;
    23  }Stu; 
    24   
    25  //重定义结构体,类型为struct Student 或者是Stu
    26  typedef struct  Student  
    27  {
    28      string name;
    29      double eng;
    30      double ch;
    31  }Stu; 
    32   
    33  //重定义结构体,类型为Stu
    34  typedef struct  
    35  {
    36      string name;
    37      double eng;
    38      double ch;
    39  }Stu;
    40   

    如果用typedef则,Stu stu; 
    否则,struct Student stu; 

  • 相关阅读:
    重构了一波代码,聊聊后端也聊聊游戏后端
    浅谈游戏开发中常见的设计模式
    一次查内存泄露
    sql语句技巧
    python后端链接数据库-----MySQLdb
    web的应用模式
    静态文件
    django配置文件
    视图
    django子应用
  • 原文地址:https://www.cnblogs.com/iack/p/3817554.html
Copyright © 2011-2022 走看看