声明一个结构体worker,包含姓名年龄工号性别工资等成员并初始化zhangsan,20,111000
时间: 2024-05-15 15:17:01 浏览: 93
,男,5000元的一个实例。
```c
#include <stdio.h>
struct worker {
char name[20];
int age;
int id;
char gender[10];
float salary;
};
int main() {
struct worker zhangsan = {"zhangsan", 20, 111000, "男", 5000.0};
printf("姓名:%s\n", zhangsan.name);
printf("年龄:%d\n", zhangsan.age);
printf("工号:%d\n", zhangsan.id);
printf("性别:%s\n", zhangsan.gender);
printf("工资:%.2f元\n", zhangsan.salary);
return 0;
}
```
阅读全文