C examples for Structure:Structure Value
Using the Structure Address
#include <stdio.h> #define FUNDLEN 50/*from www .j a va 2 s. c o m*/ struct BackCount { char bank[FUNDLEN]; double bankfund; char save[FUNDLEN]; double savefund; }; double sum(const struct BackCount *); /* argument is a pointer */ int main(void){ struct BackCount stan = {"t1",1234.56,"t2",4321.21}; printf("Stan has a total of $%.2f.\n", sum(&stan)); return 0; } double sum(const struct BackCount * money) { return(money->bankfund + money->savefund); }