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.

6th Nov 2020, 11:32 PM
amaIeltayib
3 Respuestas
+ 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
7th Nov 2020, 12:02 AM
Mariano Fregosi
Mariano Fregosi - avatar
+ 1
You can try that yourself here in code playground or anywhere else you might prefer
7th Nov 2020, 12:05 AM
Benjamin Jürgens
Benjamin Jürgens - avatar