📄 ch23-6.c
字号:
#include "stdio.h"
#include "string.h"
struct student
{
int num;
char name[20];
float score[3];
};
void output(struct student stu) /*函数形参也是结构体变量*/
{
printf("%d\n%s\n%f\n%f\n%f\n",stu.num,stu.name,stu.score[0],stu.score[1],
stu.score[2]);
printf("\n");
}
void main()
{
void output(struct student);
struct student boy; /*定义结构体变量*/
boy.num=110;
strcpy(boy.name, "xiao ming");
boy.score[0]=75.2;
boy.score[1]=83.4;
boy.score[2]=90.6;
output(boy);/*结构体变量作函数的实参*/
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -