879
Unused variables (sh.itjust.works)
submitted 5 months ago by [email protected] to c/[email protected]
you are viewing a single comment's thread
view the rest of the comments
[-] [email protected] 5 points 5 months ago

Lets say you use a variable named abcd in your function. And a variable named abcb in a for loop inside the same function. But because reasons you mistakenly use abcd inside that loop and modify the wrong variable, so that your code sometimes doesnt work properly.

It's to prevent mistakes like that.

A similar thing is to use const when the variable is not modified.

this post was submitted on 21 Apr 2024
879 points (97.9% liked)

Programmer Humor

19197 readers
1133 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS