I have a program that constantly calls a function. In my function i use variables that are only used inside of that function. Is it better “Style” to have these variables as global so that they are not constantly being created or better to have them in the function since they are irrelevant for the rest of the program.
Thanks
What you are doing is correct. You want to avoid global scope variables. Let the compiler or interpreter take care of any memory usage optimization. If you go down the other road you will be in a world of hurt.