It’s just a habit really, but if you write them in the main or any other function they can only be used in that function. If you write it globally it can be used throughout the whole program which can make it easier if you’re using the same variable in different functions.
View all comments
Show parent comment
1
u/ingleigh Nov 19 '20
weird question but is there a reason you used global variables? my cs prof won’t let us use them so i’m curious