第7篇 用户定制数据类型.pptVIP

  • 5
  • 0
  • 约1.87万字
  • 约 61页
  • 2017-06-13 发布于湖北
  • 举报
结构:同一个数据项的若干成分构成的一个整体。 例如:学生档案,每个学生有学号、姓名、性别、出生地、出生年月、学业成绩等。 ●结构的定义 struct student { long int num; char name[20]; float score; }; 定义一个结构类型: struct student ● 结构变量的定义 1、先定义结构类型,再定义变量 struct student { long int num; char name[20]; float score; }; struct student stu1, stu2; 2、定义结构类型的同时定义变量 struct student { long int num; char name[20]; float score; }stu1, stu2; ●自定义类型 用 typedef 定义新的类型名代替已有的类型 旧 新 例1、typedef int INTEGER; int i, j; ==== INTEGER i, j; 例2、 typedef int* POINT;

文档评论(0)

1亿VIP精品文档

相关文档