结构
来源:互联网 发布:淘宝虚拟物品不给退款 编辑:程序博客网 时间:2024/04/30 06:13
结构:一种构造的数据类型
声明结构一般形式:
struct 结构类型名
{
成员表
};
struct StudentType
{
intnum;
char*name;
charsex[3];
floatscore;
};
结构类型变量的定义
1:先声明再定义
struct 结构类型名
{
成员表
};
struct 结构类型名 结构变量表;
struct StudentType
{
intnum;
char*name;
charsex[3];
floatscore;
};
struct StudentType boy,girl;
struct StudentType student[3];//定义结构类型数组
2:先声明的同时定义
struct 结构类型名
{
成员表;
}结构变量表;
struct StudentType
{
intnum;
char*name;
charsex[3];
floatscore;
}boy,girl;//student[3],结构类型数组
3:直接定义
struct
{
成员表
}结构变量表;
struct
{
intnum;
char*name;
charsex[3];
floatscore;
}boy,girl;//student[3];结构类型数组。
嵌套的结构类型
struct DateType
{
intyear;
intmonth;
intday;
};
struct StudentType
{
intnum;
char*name;
charsex[3];
structDateType birthday;
floatscore;
}boy,girl;
结构类型变量可定义时直接初始化
struct StudentType student=
{
1010;
“德华”;
“男”;
{1993,6,18};
99.8;
};
指针访问结构类型变量各个成员
(*结构类型指针变量).成员名
结构指针变量->成员名
- 结构
- 结构
- 结构
- 结构
- 结构
- 结构
- 结构
- 结构
- 结构
- 结构
- 结构
- 结构
- 结构
- 结构
- 结构
- 结构
- 结构
- 结构
- POJ 1987 Distance Statistics(树的点分治)
- hadoop-0.21.0 在Windows环境下的部署(1)Cygwin 安装
- 迁移数据库——复制所有数据文件,启动数据库
- 采用标准c进行目录文件遍历
- div+css排版
- 结构
- VC/MFC DDX和DDV机制介绍
- Win7 UAC机制和应用程序数字签名研究
- dom4j解析、修改、生成xml文件(转)
- android scrollview 简单的使用
- typedef
- poj1426 Find The Multiple
- Oracle 监听器 Listener
- 【微软雅黑字体的简单介绍】