c++ - Avoid global variables in my program -
i have global variables in program , tried avoid them don't know how..
here program: here
is there alternative avoid variables?
and other remark appriciated too
i think have multiple possibilities.
- create class , put functions , global variables inside (preferred way)
- if care name conflicts can use unnamed namespaces
- it global variable used in 1 function, declare static variable inside function (its value kept between calls)
Comments
Post a Comment