pragma mark 结构体-数组
pragma mark 概念
pragma mark 代码
#include <stdio.h>
int main()
{
#warning 要求定义变量保存公司所有部门的绩效
struct Bumen
{
char *name;
int count; // 人数
double kpi; // 绩效
};
struct Bumen ios = {"iOS",20,100.0};
struct Bumen android = {"Android",10,88.0};
struct Bumen php = {"Php",220,77.0};
// 元素类型 数组名称[元素个数];
struct Bumen bumens[3] =
{
{"iOS",20,100.0},
{"Android",10,88.0},
{"Php",220,77.0},
};
// bumens[0] == ios
// ios.name;ios.count,ios.kpi;
bumens[0].name = "IOSvvv";
bumens[0].count = 22;
bumens[0].kpi = 100;
printf("name = %s,count = %i, kpi = %lf\n",bumens[0].name,bumens[0].count,bumens[0].kpi);
return 0;
}