What are the advantages of using const local variables?
Show answer and explanation
A const local variable documents that its value is stable after initialization and lets the compiler reject accidental writes. It narrows the mutable state a reader must track, though const should not be added when later reassignment is intentional.
A const local variable documents that its value is stable after initialization and lets the compiler reject accidental writes. It narrows the mutable state a reader must track, though const should not be added when later reassignment is intentional.
Connect the conclusion directly to the type, lifetime, ownership, overload-resolution rule, or library contract present in the question. State implementation dependence or a violated precondition explicitly instead of merely guessing output.