zoukankan      html  css  js  c++  java
  • C语言之结构体数组

    1.结构体数组的定义

      类型  变量名[常量表达式];

    // 定义结构体类习性
    struct stStudent{
        int Age;
        int Level;
    }
    
    // 定义结构体变量
    struct stStudent st;
    
    // 定义结构体数组
    struct stStudent arr[10]   或者  stStudent arr[10]

    2.结构体数组的初始化

    struct stStudent{
        int Age;
        int Level;   
    }
    struct stStudent arr[5]={{0,0},{1,1},{2,2,},{3,3,},{4,4}}
    
    // 或者
    arr[0].Age=100;
    arr[0].Level=100;

    3.结构体成员的使用

    格式:

      结构体数组名[下标].成员名——arr[1].Age

  • 相关阅读:
    POJ 1451
    LightOJ 1224
    POJ 2001
    HDU 2072
    POJ 3764
    CH 1602
    CH 1601
    Gym 101873K
    CH 1201
    Gym 101873C
  • 原文地址:https://www.cnblogs.com/codexlx/p/13432604.html
Copyright © 2011-2022 走看看