> In C, you used to have to declare all local variables at the top of the function rather than throughout the body.
This is true, but support for block-scoped (as opposed to function-scoped) variable declarations was added to C a long time ago. Every version of ANSI C supports them, and this stack exchange answer, https://softwareengineering.stackexchange.com/a/300274/19196, suggests that support was added to K&R C since at least 1978.