+ 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 !

15th Feb 2019, 12:44 AM
Abdulroaf Almaaloul
Abdulroaf Almaaloul - avatar
1 Respuesta
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.
3rd Feb 2021, 8:11 PM
David
David - avatar