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.

  1. create class , put functions , global variables inside (preferred way)
  2. if care name conflicts can use unnamed namespaces
  3. it global variable used in 1 function, declare static variable inside function (its value kept between calls)

Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -