Having identifiers unintentionally shadowed from the outer scope by the inner scope can possibly lead to bugs in code.
Consider using unique identifier names.
int main(int argc, char** argv) {
for (int i = 0; i < argc - 1; i++) {
int argc = i + 1;
// do stuff
printf("arg %d of %d", i, argc);
}
}
int main(int argc, char** argv) {
for (int i = 0; i < argc; i++) {
int argi = i + 1;
// do stuff
printf("arg %d of %d", i, argc);
}
}