+ 1
help a beginner plzz
don't know when to use a declaration out of "main", and how it will affect to the main body !
1 Réponse
0
In general, you should keep all your code inside main. Just write outside function definitions, prototypes and that kind of things.
If you declare a variable outside main, it is global and you can use it in all your functions as its scope is the whole program. Anyway, global variables should be avoided. You can pass them as arguments instead.