C語言_在自定義函式裡使用結構體_Cplus14.6
#define FUNDLEN 50
struct fund
{
char bank[FUNDLEN];
double bankfund;
char save[FUNDLEN];
double savefund;
};
double sum(struct fund*);
main()
{
struct fund stan=
{"qqq",123,"eee",456};
printf("the stan total is %.2f\n",sum(&stan));
}
double sum(struct fund* money)
{
return(money->bankfund+money->savefund);
}