Practice ยท 2 of 4
Internal Linkage Twins
Implement a file-scope static counter pair that demonstrates internal
linkage semantics:
``c
int tally_a(int n); /* uses static accumulator a_count */
int tally_b(int n); /* uses static accumulator b_count */
`
Each function adds n to its own accumulator (both start at 0) and returns the
new total. The two accumulators must be independent โ that is the whole point of
internal linkage. Also implement int peek_a(void)` returning a_count unchanged.
Difficulty: intermediate
Press Submit to check your solution.
Back to lesson: Practice: Read the Build