二、代码
#include <stdio.h>
int main()
{
// 要求定义变量保存 公司所有部门的绩效(部门名称,部门人数,绩效)
struct Bumen
{
char *name;
int count;
double kpi;
};
struct Bumen ios = {"iOS",20,100.0};
struct Bumen android = {"Android",20,100.0};
struct Bumen php = {"Php",20,100.0};
// 元素类型 数组名称[元素个数];
struct Bumen bumens[3] =
{
{"iOS",20,100.0},
{"Android",20,100.0},
{"Php",20,100.0}
};
// bumens[0] == ios
// ios.name;
// ios.count;
// ios.kpi;
bumens[0].name = "iossss";
bumens[0].count = 33;
bumens[0].kpi = 99.9;
printf("name = %s,count = %i,kpi = %lf\n",bumens[0].name,bumens[0].count,bumens[0].kpi);
return 0;
}