pragma mark 結(jié)構(gòu)體-數(shù)組
pragma mark 概念
pragma mark 代碼
#include <stdio.h>
int main()
{
#warning 要求定義變量保存公司所有部門的績效
struct Bumen
{
char *name;
int count; // 人數(shù)
double kpi; // 績效
};
struct Bumen ios = {"iOS",20,100.0};
struct Bumen android = {"Android",10,88.0};
struct Bumen php = {"Php",220,77.0};
// 元素類型 數(shù)組名稱[元素個數(shù)];
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;
}
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者