Download

how many variables necessary ?

Another question that concerns me very much:
There are functions, there only one variable of several is needed to make it work.
Then there are other functions, there every variable has to be used to make it work, can you see that somewhere before, how many are absolutely necessary?

You should create variables to the point that they are helpful to your functions and you can use local variables in side your functions which you feel they aren’t needed to be saved in global scope

Also use optional arguments for arguments that are less commonly passed in:

https://stackoverflow.com/questions/…-a-method-in-c