01-07、结构体-结构体类型数组的定义及获取数据

#include

int main(int argc,const char * argv[]){

//要求定义变量保存公司中所有部门的绩效

struct Bumen

{

char *name;

int count;

double kpi;

};

struct Bumen ios = {"iOS",20,100.0};

struct Bumen andorid = {"Andoird",10,99.0};

struct Bumen php = {"php",500,88.0};

//元素类型数组名称[元素个数];

struct Bumen bumens[3]=

{

{"iOS",20,100.0},// 0

{"Andoird",10,99.0},

{"php",500,88.0}

};

//bumens[0]== ios

bumens[0].name = "iOSv587";

bumens[0].count = 99;

bumens[0].kpi = 100.0;

printf("name = %s,count = %i,kpi = %lf\n",bumens[0].name,bumens[0].count,bumens[0].kpi);

return 0;

}

你可能感兴趣的:(01-07、结构体-结构体类型数组的定义及获取数据)