初学者,请教字段是什么意思?字段宽度是什么意思?

马振宇 2019-07-19 02:19:22
初学者,请教字段是什么意思?字段宽度是什么意思?
...全文
802 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
赵4老师 2019-07-19
  • 打赏
  • 举报
回复
表的基础知识
表是包含数据库中所有数据的数据库对象。表定义是一个列集合。数据在表中的组织方式与在电子表格中相似,都是按行和列的格式组织的。每一行代表一条唯一的记录,每一列代表记录中的一个字段。例如,在包含公司雇员数据的表中,每一行代表一名雇员,各列分别代表该雇员的信息,如雇员编号、姓名、地址、职位以及家庭电话号码等。

赵4老师 2019-07-19
  • 打赏
  • 举报
回复
struct
struct [tag] { member-list } [declarators];

[struct] tag declarators;

The struct keyword defines a structure type and/or a variable of a structure type. See Anonymous Structures and Unsized Array in a Structure for more information.

A structure type is a user-defined composite type. It is composed of "fields" or "members" that can have different types.

In C++, a structure is the same as a class except that its members are public by default.

Using a Structure

In C, you must explicitly use the struct keyword to declare a structure. In C++, this is unnecessary once the type has been defined.

You have the option of declaring variables when the structure type is defined by placing one or more comma-separated variable names between the closing brace and the semicolon.

For related information, see class, union, and enum.

Example 1

struct PERSON // Declare PERSON struct type
{
int age; // Declare member types
long ss;
float weight;
char name[25];
} family_member; // Define object of type PERSON

struct PERSON sister; // C style structure declaration
PERSON brother; // C++ style structure declaration

sister.age = 13; // assign values to members
brother.age = 7;
Structure variables can be initialized. The initialization for each variable must be enclosed in braces.

Example 2

struct POINT // Declare POINT structure
{
int x; // Define members x and y
int y;
} spot = { 20, 40 }; // Variable spot has
// values x = 20, y = 40
struct POINT there; // Variable there has POINT type
struct CELL // Declare CELL bit field
{
unsigned character : 8; // 00000000 ????????
unsigned foreground : 3; // 00000??? 00000000
unsigned intensity : 1; // 0000?000 00000000
unsigned background : 3; // 0???0000 00000000
unsigned blink : 1; // ?0000000 00000000
} screen[25][80]; // Array of bit fields

69,371

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧