The main program keeps track of information on members of a health club. It calls a function AddMember() when there is a new membership. The membership counts are kept track of in main(), so main() can pass this info to other functions.
void main() { int total_cnt, At memory location 1000 family_cnt, At memory location 2000 adult_cnt, At memory location 1600 child_cnt; At memory location 2200
The variables above are known to main(), not AddMember(). AddMember() will not recognize their names.
The function header for AddMember() is
void AddMember(int *totalptr, int *fptr, int *aptr, int *cptr)
where totalptr is a pointer to the total count (total_cnt), fptr is a pointer to the family count (family_cnt), etc.
1. Write a calling statement for AddMember(), from main.
2. Assume the variables have these current values, total_cnt = 204, family_cnt = 52, adult_cnt = 108, child_cnt = 96, when main() calls AddMember(). In the chart below, write the value of the expression, or check the ERROR column if the expression would result in a syntax error.
VALUE ERROR If the expresion is IN main total_cnt __________ _____ &total_cnt __________ _____ *totalptr __________ _____ &totalptr __________ _____ adult_cnt __________ _____ &adult_cnt __________ _____ &child_cnt __________ _____ *family_cnt __________ _____
If the expression is IN AddMember totalptr __________ _____ fptr __________ _____ *aptr __________ _____ &cptr __________ _____ &total_cnt __________ _____ *total_cnt __________ _____ *totalptr __________ _____ *fptr __________ _____