Skip to content

Use descriptive loop index names in Multidimensional Arrays exercise - #887

Open
icaromol wants to merge 1 commit into
ronreiter:masterfrom
icaromol:refactor/descriptive-index-names-multidim-arrays
Open

Use descriptive loop index names in Multidimensional Arrays exercise#887
icaromol wants to merge 1 commit into
ronreiter:masterfrom
icaromol:refactor/descriptive-index-names-multidim-arrays

Conversation

@icaromol

@icaromol icaromol commented Aug 5, 2026

Copy link
Copy Markdown

Summary

  • The Multidimensional Arrays exercise (learn-c.org) uses single-letter loop indices i (subject) and j (student), which requires the reader to remember what each one maps to.
  • Renamed isubjectIndex and jstudentIndex throughout the Tutorial Code and Solution sections so the indices self-document what they iterate over.
  • No other changes — variable roles, loop bounds, and logic are untouched.

No behavior change — output is still:

The average marks obtained in subject 0 is: 78.80
The average marks obtained in subject 1 is: 82.80

Test plan

  • Compiled the updated Solution with gcc -Wall and confirmed output matches exactly.
  • Diff limited to the renamed identifiers and the corresponding TODO/printf references — no other formatting/prose changes.

Renamed i/j to subjectIndex/studentIndex in the grades example so the
loop variables read as what they represent (a subject row, a student
column) rather than requiring the reader to remember the mapping.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant