My solution using global declarations-opinions?

Ok so i found out some more information on the use of globals here