c语言之结构

定义结构

struct point {
    int x;
    int y; 
};

定义结构并声明变量

struct point {
    int x;
    int y; 
}pt1,pt2,pt3;

声明结构变量

struct point pt;

声明结构变量并赋值

struct point maxpt = {320, 200};

成员的访问

结构名.成员

嵌套结构体 

struct rect { 
    struct point pt1; 
    struct point pt2; 
};

结构数组

struct key { 
    char *word; 
    int count;
} keytab[NKEYS]
原文地址:https://www.cnblogs.com/zhangwanhua/p/8453903.html