Step 4 of 6
const-correct interfaces
In a header, a function's signature is a contract. Mark every pointer parameter the function only reads as const:
size_t count_alive(const Player *team, size_t n); /* reads only */
void heal_all(Player *team, size_t n, int amount); /* modifies */
Callers can then pass const data safely, and readers know at a glance which functions have side effects. Adding const later is painful because it ripples through every caller, so get it right from the start.
Your turn: fix the three signatures. The read-only ones need const; heal_all really does modify the team, so it must stay non-const.
Previous: extern and shared state Next: Command-line arguments