结构体1

作者: 时间:2020-07-09 点击数:

struct
 {
    char name[20];
 int age;
 int score;
 }st1;
 定义了一个新的数据类型,定义一个属于这个类型的变量,变量名为st1
如何使用结构体变量
  (1)结构体变量的定义
      struct 结构体名 变量;
   struct student
 {
    char name[20];
 int age;
 int score;
 };
 struct student st1;
 struct student st2,st3,*st4;
 struct student st5={"zhangsan",20,80};
注意:能够存储数据只能是变量,数据类型不能存储数据。

上一页 [1] [2] [3] [4] [5] 下一页

Copyright© 2020 Anyang Institute of Technology.All rights reserved.

学院地址:河南省安阳市黄河大道西段