0
Do you have to have "int Variable = #;" in int main() or can it be outside of the {}'s?
Please reply! I'm not sure if it would still work correctly.
3 Answers
+ 5
Yes you can, it would be a global variable that you could use anywhere in your program
You can even have another variable with the same name inside your main, in that case you can access your global variable using the "::" operator.
https://code.sololearn.com/cY4DfH3eeKY1/?ref=app
+ 1
You can try that yourself here in code playground or anywhere else you might prefer