package main import "fmt" type human struct { name, phone string age int8 } type student struct { human // 嵌套结构体 school string } type employee struct { human company string } func (h human) sayHi() { fmt.Printf("我叫%s,今年%d,联系方式%s\n", h.…
//结构体的声明 typedef struct Mwinddirectbaseline { char* p; int s; int i; }Mwinddirectbaseline; typedef struct F { char* p; int s; int i; }F; typedef struct H { char* p; int s; int i; }H; typedef struct Coordinate1 { char* p; int s; int i; }Coordinate1; t…
(一)结构体类型 1.简介: 例: struct date { int month; int day; int year; }; struct student { int num; char name[20]; char sex; int age; struct date birthday; /*birthday 是 struct date 类型*/ char addr[30]; }student1,student2; (1):结构体可嵌套 (2):与枚举相比结构体内元素为变量,而枚举为常量 (…