C语言传递结构的地址 C语言把结构成员作为参数传递 C语言传递结构实例 C语言传递结构的地址 /* funds2.c -- passing a pointer to a structure */ #include <stdio.h> #define FUNDLEN 50 struct funds { char bank[FUNDLEN]; double bankfund; char save[FUNDLEN]; double savefund; }; double sum(const struct funds *); /* argument is a pointer */ int main(void) { struct funds stan = { "Garlic-Melon Bank", 4032.27, "Lucky's Savings and Loan", 8543.94 }; printf("Stan has a total of $%.2f.\n", sum(&stan)); return 0; } double sum(const struct funds * money) { return(money->bankfund + money->savefund); } C语言把结构成员作为参数传递 C语言传递结构实例