0
It will probably be covered in a later lesson, but shouldn't variables be declared before the main () function?
2 Respuestas
+ 4
it is sometimes considered bad practice to declare variables before main(), and is those variables called global variables.
the main concern with them, is you have limited control over them, and basically every function which is declared on the same code file is able to make changes to them.
+ 1
Variable scoping wasn't discussed prior. Furthermore, scoping is irrelevant in trivial examples like these unless the intent is to illustrate scoping in some degree (I.e. difference between local/global, etc.).